Skip to content

Instantly share code, notes, and snippets.

@mitrallex
mitrallex / deleteFile
Created February 5, 2018 12:00
laravel-file-hosting
deleteFile() {
axios.post('files/delete/' + this.deletingFile.id)
.then(response => {
this.showNotification('File successfully deleted!', true);
this.fetchFile(this.activeTab, this.pagination.current_page);
})
.catch(error => {
this.errors = error.response.data.errors();
this.showNotification('Something went wrong! Please try again later.', false);
this.fetchFile(this.activeTab, this.pagination.current_page);
@mitrallex
mitrallex / endEditing
Last active February 5, 2018 20:37
laravel-file-hosting
endEditing(file) {
this.editingFile = {};
let formData = new FormData();
formData.append('name', file.name);
formData.append('type', file.type);
formData.append('extension', file.extension);
axios.post('files/edit/' + file.id, formData)
.then(response => {
<?php
if (!function_exists("readline")) {
/**
* Reads a single line from the user
* @param string $prompt You may specify a string with which to prompt the user
* @return string Single string from the user
*/
function readline($prompt = null) {
if ($prompt){
body,
html {
font-family: Arial;
font-size: 13px;
}
.container {
margin: 10px !important;
}
<style type="text/css">@import url("style.css");</style>
<style type="text/css">@import url("bulma.min.css");</style>
<?php
// Define main variables
$im_folders = array('images', 'images10', 'images35', 'images_t', 'images_hq');
/**
* Select server
* @return array Server params
@mitrallex
mitrallex / main.blade.php
Last active July 27, 2018 18:06
laravel-file-hosting-refactor
<img v-if="file === editingFile" src="" :src="'{{ asset('storage/' . Auth::user()->name . '_' . Auth::id()) }}' + '/' + savedFile.type + '/' + savedFile.name + '.' + savedFile.extension" :alt="file.name">
<img v-if="file !== editingFile" src="" :src="'{{ asset('storage/' . Auth::user()->name . '_' . Auth::id()) }}' + '/' + file.type + '/' + file.name + '.' + file.extension" :alt="file.name">
@mitrallex
mitrallex / FileController.php
Last active July 27, 2018 18:09
laravel-file-hosting-refactor
<?php
class FileController extends Controller
{
/**
* Constructor
*/
public function __construct()
{
$this->middleware('auth');
}
@mitrallex
mitrallex / File.php
Last active July 31, 2018 12:36
laravel-file-hosting-refactor
<?php
class File extends Model
{
protected $fillable = [
'name', 'type', 'extension', 'user_id'
];
public static $image_ext = ['jpg', 'jpeg', 'png', 'gif'];
public static $audio_ext = ['mp3', 'ogg', 'mpga'];
public static $video_ext = ['mp4', 'mpeg'];
@mitrallex
mitrallex / index.blade.php
Created August 6, 2018 11:30
laravel-google-recaptcha
@extends('layouts.app')
@section('content')
<div class="row justify-content-center">
<div class="col-10">
<div class="card">
<div class="card-header">
Feedbacks list
</div>
<div class="card-body">
@mitrallex
mitrallex / create.blade.php
Created August 6, 2018 11:31
laravel-google-recaptcha
@extends('layouts.app')
@section('content')
<div class="row justify-content-center">
<div class="col-6">
<div class="card">
<div class="card-header">
Feedback Form
</div>
<div class="card-body">