This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.Vue = require('vue'); | |
| window.axios = require('axios'); | |
| let token = document.head.querySelector('meta[name="csrf-token"]'); | |
| if (token) { | |
| window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content; | |
| } else { | |
| console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html lang="{{ app()->getLocale() }}"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <!-- CSRF Token --> | |
| <meta name="csrf-token" content="{{ csrf_token() }}"> | |
| <script> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @extends('layouts.app') | |
| @section('content') | |
| <div class="container is-fluid box"> | |
| <div class="tabs is-centered is-large"> | |
| <ul> | |
| <li :class="{'is-active': isActive('image')}" @click="getFiles('image')"> | |
| <a> | |
| <span class="icon is-small"><i class="fa fa-image"></i></span> | |
| <span>Pictures</span> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <transition name="modal"> | |
| <div class="modal-mask" v-if="showConfirm" v-cloak> | |
| <div class="modal-wrapper"> | |
| <div class="modal-container"> | |
| <div class="modal-body"> | |
| <h2>Are you sure?</h2> | |
| </div> | |
| <div class="modal-footer"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="modal" :class="{'is-active' : modalActive}"> | |
| <div class="modal-background" @click="closeModal()"></div> | |
| <div class="modal-content"> | |
| <p class="image is-4by3"> | |
| <img src="" :src="'{{ asset('storage/' . Auth::user()->name . '_' . Auth::id()) }}' + '/' + file.type + '/' + file.name + '.' + file.extension" :alt="file.name"> | |
| </p> | |
| </div> | |
| <button class="modal-close is-large" aria-label="close" @click="closeModal()"></button> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <transition name="fade"> | |
| <div class="container is-fluid" id="message" v-show="notification"> | |
| <div class="notification is-success" v-cloak v-if="!anyError()"> | |
| <button class="delete" @click="notification=false"></button> | |
| <h1 class="subtitle"> | |
| @{{ message }} | |
| </h1> | |
| </div> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <div class="container is-fluid box"> | |
| <div class="new-file"> | |
| <form id="new-file-form" action="#" method="#" @submit.prevent="submitForm"> | |
| <div class="field is-grouped"> | |
| <p class="control is-expanded"> | |
| <input class="input" type="text" name="name" placeholder="File name" v-model="fileName" required> | |
| </p> | |
| <div class="file is-info has-name"> | |
| <label class="file-label"> | |
| <input class="file-input" type="file" ref="file" name="file" @change="addFile()"> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $this->validate($request, [ | |
| 'name' => 'required|unique:files', | |
| 'file' => 'required|file|mimes:' . $all_ext . '|max:' . $max_size | |
| ]); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (Storage::putFileAs('/public/' . $this->getUserDir() . '/' . $type . '/', $file, $request['name'] . '.' . $ext)) { | |
| return $model::create([ | |
| 'name' => $request['name'], | |
| 'type' => $type, | |
| 'extension' => $ext, | |
| 'user_id' => Auth::id() | |
| ]); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if (Storage::disk('local')->exists($old_filename)) { | |
| if (Storage::disk('local')->move($old_filename, $new_filename)) { | |
| $file->name = $request['name']; | |
| return response()->json($file->save()); | |
| } | |
| } |