mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-06 02:33:48 +00:00
- added model events for generate uuid
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\FileManagerFile;
|
||||
use App\File;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Resources\UsersCollection;
|
||||
use App\Services\StripeService;
|
||||
@@ -33,7 +33,7 @@ class DashboardController extends Controller
|
||||
$total_users = User::all()->count();
|
||||
|
||||
// Get total used space
|
||||
$total_used_space = FileManagerFile::all()->map(function ($item) {
|
||||
$total_used_space = File::all()->map(function ($item) {
|
||||
return (int)$item->getRawOriginal('filesize');
|
||||
})->sum();
|
||||
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\FileManagerFile;
|
||||
use App\FileManagerFolder;
|
||||
use App\File;
|
||||
use App\Folder;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\ChangeRoleRequest;
|
||||
use App\Http\Requests\Admin\ChangeStorageCapacityRequest;
|
||||
@@ -231,10 +231,10 @@ class UserController extends Controller
|
||||
|
||||
$shares = Share::where('user_id', $user->id)->get();
|
||||
|
||||
$files = FileManagerFile::withTrashed()
|
||||
$files = File::withTrashed()
|
||||
->where('user_id', $user->id)
|
||||
->get();
|
||||
$folders = FileManagerFolder::withTrashed()
|
||||
$folders = Folder::withTrashed()
|
||||
->where('user_id', $user->id)
|
||||
->get();
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Content;
|
||||
use App\FileManagerFile;
|
||||
use App\FileManagerFolder;
|
||||
use App\File;
|
||||
use App\Folder;
|
||||
use App\Http\Requests\PublicPages\SendMessageRequest;
|
||||
use App\Http\Resources\PageResource;
|
||||
use App\Http\Tools\Demo;
|
||||
@@ -120,7 +120,7 @@ class AppFunctionsController extends Controller
|
||||
if ($shared->type === 'file') {
|
||||
|
||||
// Get file record
|
||||
$file = FileManagerFile::where('user_id', $shared->user_id)
|
||||
$file = File::where('user_id', $shared->user_id)
|
||||
->where('unique_id', $shared->item_id)
|
||||
->first();
|
||||
|
||||
@@ -142,7 +142,7 @@ class AppFunctionsController extends Controller
|
||||
if ($shared->type === 'folder') {
|
||||
|
||||
// Get file record
|
||||
$folder = FileManagerFolder::where('user_id', $shared->user_id)
|
||||
$folder = Folder::where('user_id', $shared->user_id)
|
||||
->where('unique_id', $shared->item_id)
|
||||
->first();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\FileManagerFolder;
|
||||
use App\Folder;
|
||||
use App\Http\Tools\Editor;
|
||||
use App\Http\Tools\Guardian;
|
||||
use App\Share;
|
||||
@@ -13,7 +13,7 @@ use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\File;
|
||||
use Illuminate\Http\Request;
|
||||
use App\FileManagerFile;
|
||||
use App\File;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Exceptions\HttpResponseException;
|
||||
@@ -76,7 +76,7 @@ class FileAccessController extends Controller
|
||||
$user_id = Auth::id();
|
||||
|
||||
// Get file record
|
||||
$file = FileManagerFile::withTrashed()
|
||||
$file = File::withTrashed()
|
||||
->where('user_id', $user_id)
|
||||
->where('basename', $filename)
|
||||
->firstOrFail();
|
||||
@@ -167,7 +167,7 @@ class FileAccessController extends Controller
|
||||
}
|
||||
|
||||
// Get file record
|
||||
$file = FileManagerFile::where('user_id', $shared->user_id)
|
||||
$file = File::where('user_id', $shared->user_id)
|
||||
->where('basename', $filename)
|
||||
->firstOrFail();
|
||||
|
||||
@@ -191,7 +191,7 @@ class FileAccessController extends Controller
|
||||
public function get_thumbnail(Request $request, $filename)
|
||||
{
|
||||
// Get file record
|
||||
$file = FileManagerFile::withTrashed()
|
||||
$file = File::withTrashed()
|
||||
->where('user_id', $request->user()->id)
|
||||
->where('thumbnail', $filename)
|
||||
->firstOrFail();
|
||||
@@ -223,7 +223,7 @@ class FileAccessController extends Controller
|
||||
}
|
||||
|
||||
// Get file record
|
||||
$file = FileManagerFile::where('user_id', $shared->user_id)
|
||||
$file = File::where('user_id', $shared->user_id)
|
||||
->where('thumbnail', $filename)
|
||||
->firstOrFail();
|
||||
|
||||
|
||||
@@ -9,8 +9,8 @@ use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Http\Request;
|
||||
use App\FileManagerFolder;
|
||||
use App\FileManagerFile;
|
||||
use App\Folder;
|
||||
use App\File;
|
||||
use App\Share;
|
||||
|
||||
class BrowseController extends Controller
|
||||
@@ -27,12 +27,12 @@ class BrowseController extends Controller
|
||||
$user_id = Auth::id();
|
||||
|
||||
// Get folders and files
|
||||
$folders_trashed = FileManagerFolder::onlyTrashed()
|
||||
$folders_trashed = Folder::onlyTrashed()
|
||||
->with(['trashed_folders', 'parent'])
|
||||
->where('user_id', $user_id)
|
||||
->get(['parent_id', 'unique_id', 'name']);
|
||||
|
||||
$folders = FileManagerFolder::onlyTrashed()
|
||||
$folders = Folder::onlyTrashed()
|
||||
->with(['parent'])
|
||||
->where('user_id', $user_id)
|
||||
->whereIn('unique_id', filter_folders_ids($folders_trashed))
|
||||
@@ -40,7 +40,7 @@ class BrowseController extends Controller
|
||||
->get();
|
||||
|
||||
// Get files trashed
|
||||
$files_trashed = FileManagerFile::onlyTrashed()
|
||||
$files_trashed = File::onlyTrashed()
|
||||
->with(['parent'])
|
||||
->where('user_id', $user_id)
|
||||
->whereNotIn('folder_id', array_values(array_unique(recursiveFind($folders_trashed->toArray(), 'unique_id'))))
|
||||
@@ -71,13 +71,13 @@ class BrowseController extends Controller
|
||||
->pluck('item_id');
|
||||
|
||||
// Get folders and files
|
||||
$folders = FileManagerFolder::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
$folders = Folder::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
->where('user_id', $user_id)
|
||||
->whereIn('unique_id', $folder_ids)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
$files = FileManagerFile::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
$files = File::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
->where('user_id', $user_id)
|
||||
->whereIn('unique_id', $file_ids)
|
||||
->sortable()
|
||||
@@ -112,7 +112,7 @@ class BrowseController extends Controller
|
||||
public function participant_uploads() {
|
||||
|
||||
// Get User
|
||||
$uploads = FileManagerFile::with(['parent'])
|
||||
$uploads = File::with(['parent'])
|
||||
->where('user_id', Auth::id())
|
||||
->whereUserScope('editor')
|
||||
->sortable()
|
||||
@@ -137,14 +137,14 @@ class BrowseController extends Controller
|
||||
if ($request->query('trash')) {
|
||||
|
||||
// Get folders and files
|
||||
$folders = FileManagerFolder::onlyTrashed()
|
||||
$folders = Folder::onlyTrashed()
|
||||
->with('parent')
|
||||
->where('user_id', $user_id)
|
||||
->where('parent_id', $unique_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
$files = FileManagerFile::onlyTrashed()
|
||||
$files = File::onlyTrashed()
|
||||
->with('parent')
|
||||
->where('user_id', $user_id)
|
||||
->where('folder_id', $unique_id)
|
||||
@@ -156,13 +156,13 @@ class BrowseController extends Controller
|
||||
}
|
||||
|
||||
// Get folders and files
|
||||
$folders = FileManagerFolder::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
$folders = Folder::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
->where('user_id', $user_id)
|
||||
->where('parent_id', $unique_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
$files = FileManagerFile::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
$files = File::with(['parent', 'shared:token,id,item_id,permission,protected,expire_in'])
|
||||
->where('user_id', $user_id)
|
||||
->where('folder_id', $unique_id)
|
||||
->sortable()
|
||||
@@ -179,7 +179,7 @@ class BrowseController extends Controller
|
||||
*/
|
||||
public function navigation_tree() {
|
||||
|
||||
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||
$folders = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
->where('parent_id', 0)
|
||||
->where('user_id', Auth::id())
|
||||
->sortable()
|
||||
@@ -208,10 +208,10 @@ class BrowseController extends Controller
|
||||
$query = remove_accents($request->input('query'));
|
||||
|
||||
// Search files id db
|
||||
$searched_files = FileManagerFile::search($query)
|
||||
$searched_files = File::search($query)
|
||||
->where('user_id', $user_id)
|
||||
->get();
|
||||
$searched_folders = FileManagerFolder::search($query)
|
||||
$searched_folders = Folder::search($query)
|
||||
->where('user_id', $user_id)
|
||||
->get();
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ use Illuminate\Support\Facades\Auth;
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Tools\Guardian;
|
||||
use App\Http\Tools\Editor;
|
||||
use App\FileManagerFolder;
|
||||
use App\FileManagerFile;
|
||||
use App\Folder;
|
||||
use App\File;
|
||||
use Exception;
|
||||
|
||||
|
||||
@@ -268,7 +268,7 @@ class EditItemsController extends Controller
|
||||
* Upload file for authenticated master|editor user
|
||||
*
|
||||
* @param UploadRequest $request
|
||||
* @return FileManagerFile|Model
|
||||
* @return File|Model
|
||||
* @throws Exception
|
||||
*/
|
||||
public function user_upload(UploadRequest $request)
|
||||
@@ -300,7 +300,7 @@ class EditItemsController extends Controller
|
||||
*
|
||||
* @param UploadRequest $request
|
||||
* @param $token
|
||||
* @return FileManagerFile|Model
|
||||
* @return File|Model
|
||||
* @throws Exception
|
||||
*/
|
||||
public function guest_upload(UploadRequest $request, $token)
|
||||
@@ -354,7 +354,7 @@ class EditItemsController extends Controller
|
||||
}
|
||||
|
||||
// Get folder
|
||||
$folder = FileManagerFolder::whereUserId($user_id)
|
||||
$folder = Folder::whereUserId($user_id)
|
||||
->where('unique_id', $unique_id);
|
||||
|
||||
if (! $folder->exists()) {
|
||||
@@ -387,7 +387,7 @@ class EditItemsController extends Controller
|
||||
Guardian::check_item_access($unique_id, $shared);
|
||||
|
||||
// Get folder
|
||||
$folder = FileManagerFolder::whereUserId($shared->user_id)
|
||||
$folder = Folder::whereUserId($shared->user_id)
|
||||
->where('unique_id', $unique_id);
|
||||
|
||||
|
||||
@@ -424,7 +424,7 @@ class EditItemsController extends Controller
|
||||
// Get shared token
|
||||
$shared = get_shared($request->cookie('shared_token'));
|
||||
|
||||
$file_parent_folders = FileManagerFile::whereUserId(Auth::id())
|
||||
$file_parent_folders = File::whereUserId(Auth::id())
|
||||
->whereIn('unique_id', $request->input('files'))
|
||||
->get()
|
||||
->pluck('folder_id')
|
||||
@@ -435,7 +435,7 @@ class EditItemsController extends Controller
|
||||
}
|
||||
|
||||
// Get requested files
|
||||
$files = FileManagerFile::whereUserId(Auth::id())
|
||||
$files = File::whereUserId(Auth::id())
|
||||
->whereIn('unique_id', $request->input('files'))
|
||||
->get();
|
||||
|
||||
@@ -460,7 +460,7 @@ class EditItemsController extends Controller
|
||||
// Get shared record
|
||||
$shared = get_shared($token);
|
||||
|
||||
$file_parent_folders = FileManagerFile::whereUserId($shared->user_id)
|
||||
$file_parent_folders = File::whereUserId($shared->user_id)
|
||||
->whereIn('unique_id', $request->input('files'))
|
||||
->get()
|
||||
->pluck('folder_id')
|
||||
@@ -470,7 +470,7 @@ class EditItemsController extends Controller
|
||||
Guardian::check_item_access($file_parent_folders, $shared);
|
||||
|
||||
// Get requested files
|
||||
$files = FileManagerFile::whereUserId($shared->user_id)
|
||||
$files = File::whereUserId($shared->user_id)
|
||||
->whereIn('unique_id', $request->input('files'))
|
||||
->get();
|
||||
|
||||
@@ -551,7 +551,7 @@ class EditItemsController extends Controller
|
||||
|
||||
|
||||
if ($item['type'] !== 'folder') {
|
||||
$file = FileManagerFile::where('unique_id', $unique_id)
|
||||
$file = File::where('unique_id', $unique_id)
|
||||
->where('user_id', $shared->user_id)
|
||||
->firstOrFail();
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers\FileFunctions;
|
||||
|
||||
use App\FileManagerFolder;
|
||||
use App\Folder;
|
||||
use App\Http\Tools\Demo;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use App\Http\Controllers\Controller;
|
||||
@@ -31,7 +31,7 @@ class FavouriteController extends Controller
|
||||
|
||||
// Get user & folder
|
||||
$user = Auth::user();
|
||||
$folder = FileManagerFolder::where('unique_id', $item['unique_id'])->first();
|
||||
$folder = Folder::where('unique_id', $item['unique_id'])->first();
|
||||
|
||||
if (is_demo($user->id)) {
|
||||
return Demo::favourites($user);
|
||||
|
||||
@@ -9,8 +9,8 @@ use Illuminate\Support\Facades\Storage;
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Http\Request;
|
||||
use App\FileManagerFolder;
|
||||
use App\FileManagerFile;
|
||||
use App\Folder;
|
||||
use App\File;
|
||||
|
||||
class TrashController extends Controller
|
||||
{
|
||||
@@ -29,8 +29,8 @@ class TrashController extends Controller
|
||||
}
|
||||
|
||||
// Get files and folders
|
||||
$folders = FileManagerFolder::onlyTrashed()->where('user_id', $user_id)->get();
|
||||
$files = FileManagerFile::onlyTrashed()->where('user_id', $user_id)->get();
|
||||
$folders = Folder::onlyTrashed()->where('user_id', $user_id)->get();
|
||||
$files = File::onlyTrashed()->where('user_id', $user_id)->get();
|
||||
|
||||
// Force delete folder
|
||||
$folders->each->forceDelete();
|
||||
@@ -83,7 +83,7 @@ class TrashController extends Controller
|
||||
if ($restore_item['type'] === 'folder') {
|
||||
|
||||
// Get folder
|
||||
$item = FileManagerFolder::onlyTrashed()
|
||||
$item = Folder::onlyTrashed()
|
||||
->where('user_id', $user_id)
|
||||
->where('unique_id', $restore_item['unique_id'])
|
||||
->first();
|
||||
@@ -96,7 +96,7 @@ class TrashController extends Controller
|
||||
} else {
|
||||
|
||||
// Get item
|
||||
$item = FileManagerFile::onlyTrashed()
|
||||
$item = File::onlyTrashed()
|
||||
->where('user_id', $user_id)
|
||||
->where('unique_id', $restore_item['unique_id'])
|
||||
->first();
|
||||
|
||||
@@ -15,8 +15,8 @@ use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Collection;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Arr;
|
||||
use App\FileManagerFolder;
|
||||
use App\FileManagerFile;
|
||||
use App\Folder;
|
||||
use App\File;
|
||||
use App\User;
|
||||
use App\Share;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
@@ -52,7 +52,7 @@ class FileSharingController extends Controller
|
||||
// Check if shared is image file and then show it
|
||||
if ($shared->type === 'file' && ! (int) $shared->protected) {
|
||||
|
||||
$image = FileManagerFile::where('user_id', $shared->user_id)
|
||||
$image = File::where('user_id', $shared->user_id)
|
||||
->where('type', 'image')
|
||||
->where('unique_id', $shared->item_id)
|
||||
->first();
|
||||
@@ -205,7 +205,7 @@ class FileSharingController extends Controller
|
||||
}
|
||||
|
||||
// Get file
|
||||
$file = FileManagerFile::where('user_id', $shared->user_id)
|
||||
$file = File::where('user_id', $shared->user_id)
|
||||
->where('unique_id', $shared->item_id)
|
||||
->firstOrFail(['name', 'basename', 'thumbnail', 'type', 'filesize', 'mimetype']);
|
||||
|
||||
@@ -228,7 +228,7 @@ class FileSharingController extends Controller
|
||||
$shared = Share::where('token', $request->cookie('shared_token'))->firstOrFail();
|
||||
|
||||
// Return record
|
||||
return FileManagerFile::where('user_id', $shared->user_id)
|
||||
return File::where('user_id', $shared->user_id)
|
||||
->where('unique_id', $shared->item_id)
|
||||
->firstOrFail(['name', 'basename', 'thumbnail', 'type', 'filesize', 'mimetype']);
|
||||
}
|
||||
@@ -248,7 +248,7 @@ class FileSharingController extends Controller
|
||||
Guardian::check_item_access($shared->item_id, $shared);
|
||||
|
||||
// Get folders
|
||||
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||
$folders = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
->where('parent_id', $shared->item_id)
|
||||
->where('user_id', $shared->user_id)
|
||||
->sortable()
|
||||
@@ -279,7 +279,7 @@ class FileSharingController extends Controller
|
||||
Guardian::check_item_access($shared->item_id, $shared);
|
||||
|
||||
// Get folders
|
||||
$folders = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||
$folders = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
->where('parent_id', $shared->item_id)
|
||||
->where('user_id', $shared->user_id)
|
||||
->sortable()
|
||||
@@ -309,15 +309,15 @@ class FileSharingController extends Controller
|
||||
$shared = get_shared($request->cookie('shared_token'));
|
||||
|
||||
// Search files id db
|
||||
$searched_files = FileManagerFile::search($request->input('query'))
|
||||
$searched_files = File::search($request->input('query'))
|
||||
->where('user_id', $shared->user_id)
|
||||
->get();
|
||||
$searched_folders = FileManagerFolder::search($request->input('query'))
|
||||
$searched_folders = Folder::search($request->input('query'))
|
||||
->where('user_id', $shared->user_id)
|
||||
->get();
|
||||
|
||||
// Get all children content
|
||||
$foldersIds = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||
$foldersIds = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
->where('user_id', $shared->user_id)
|
||||
->where('parent_id', $shared->item_id)
|
||||
->get();
|
||||
@@ -357,15 +357,15 @@ class FileSharingController extends Controller
|
||||
}
|
||||
|
||||
// Search files id db
|
||||
$searched_files = FileManagerFile::search($request->input('query'))
|
||||
$searched_files = File::search($request->input('query'))
|
||||
->where('user_id', $shared->user_id)
|
||||
->get();
|
||||
$searched_folders = FileManagerFolder::search($request->input('query'))
|
||||
$searched_folders = Folder::search($request->input('query'))
|
||||
->where('user_id', $shared->user_id)
|
||||
->get();
|
||||
|
||||
// Get all children content
|
||||
$foldersIds = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||
$foldersIds = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
->where('user_id', $shared->user_id)
|
||||
->where('parent_id', $shared->item_id)
|
||||
->get();
|
||||
@@ -403,12 +403,12 @@ class FileSharingController extends Controller
|
||||
*/
|
||||
private function get_items($unique_id, $shared): array
|
||||
{
|
||||
$folders = FileManagerFolder::where('user_id', $shared->user_id)
|
||||
$folders = Folder::where('user_id', $shared->user_id)
|
||||
->where('parent_id', $unique_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
$files = FileManagerFile::where('user_id', $shared->user_id)
|
||||
$files = File::where('user_id', $shared->user_id)
|
||||
->where('folder_id', $unique_id)
|
||||
->sortable()
|
||||
->get();
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace App\Http\Controllers\User;
|
||||
|
||||
use App\FileManagerFile;
|
||||
use App\FileManagerFolder;
|
||||
use App\File;
|
||||
use App\Folder;
|
||||
use App\Http\Resources\InvoiceCollection;
|
||||
use App\Http\Resources\StorageDetailResource;
|
||||
use App\Http\Resources\UserResource;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
use App\FileManagerFile;
|
||||
use App\FileManagerFolder;
|
||||
use App\File;
|
||||
use App\Folder;
|
||||
use App\User;
|
||||
use App\Setting;
|
||||
use App\Share;
|
||||
@@ -201,13 +201,13 @@ function get_item($type, $unique_id, $user_id)
|
||||
if ($type === 'folder') {
|
||||
|
||||
// Return folder item
|
||||
return FileManagerFolder::where('unique_id', $unique_id)
|
||||
return Folder::where('unique_id', $unique_id)
|
||||
->where('user_id', $user_id)
|
||||
->firstOrFail();
|
||||
}
|
||||
|
||||
// Return file item
|
||||
return FileManagerFile::where('unique_id', $unique_id)
|
||||
return File::where('unique_id', $unique_id)
|
||||
->where('user_id', $user_id)
|
||||
->firstOrFail();
|
||||
}
|
||||
@@ -245,8 +245,8 @@ function is_editor($shared)
|
||||
function get_unique_id(): int
|
||||
{
|
||||
// Get files and folders
|
||||
$folders = FileManagerFolder::withTrashed()->get();
|
||||
$files = FileManagerFile::withTrashed()->get();
|
||||
$folders = Folder::withTrashed()->get();
|
||||
$files = File::withTrashed()->get();
|
||||
|
||||
// Get last ids
|
||||
$folders_unique = $folders->isEmpty() ? 0 : $folders->last()->unique_id;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Http\Resources;
|
||||
|
||||
use App\FileManagerFile;
|
||||
use App\File;
|
||||
use ByteUnits\Metric;
|
||||
use Illuminate\Http\Resources\Json\JsonResource;
|
||||
|
||||
@@ -21,31 +21,31 @@ class UserStorageResource extends JsonResource
|
||||
];
|
||||
|
||||
// Get all images
|
||||
$images = FileManagerFile::where('user_id', $this->id)
|
||||
$images = File::where('user_id', $this->id)
|
||||
->where('type', 'image')->get()->map(function ($item) {
|
||||
return (int)$item->getRawOriginal('filesize');
|
||||
})->sum();
|
||||
|
||||
// Get all audios
|
||||
$audios = FileManagerFile::where('user_id', $this->id)
|
||||
$audios = File::where('user_id', $this->id)
|
||||
->where('type', 'audio')->get()->map(function ($item) {
|
||||
return (int)$item->getRawOriginal('filesize');
|
||||
})->sum();
|
||||
|
||||
// Get all videos
|
||||
$videos = FileManagerFile::where('user_id', $this->id)
|
||||
$videos = File::where('user_id', $this->id)
|
||||
->where('type', 'video')->get()->map(function ($item) {
|
||||
return (int)$item->getRawOriginal('filesize');
|
||||
})->sum();
|
||||
|
||||
// Get all documents
|
||||
$documents = FileManagerFile::where('user_id', $this->id)
|
||||
$documents = File::where('user_id', $this->id)
|
||||
->whereIn('mimetype', $document_mimetypes)->get()->map(function ($item) {
|
||||
return (int)$item->getRawOriginal('filesize');
|
||||
})->sum();
|
||||
|
||||
// Get all other files
|
||||
$others = FileManagerFile::where('user_id', $this->id)
|
||||
$others = File::where('user_id', $this->id)
|
||||
->whereNotIn('mimetype', $document_mimetypes)
|
||||
->whereNotIn('type', ['audio', 'video', 'image'])
|
||||
->get()->map(function ($item) {
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Http\Tools;
|
||||
|
||||
use App;
|
||||
use App\Share;
|
||||
use App\FileManagerFile;
|
||||
use App\FileManagerFolder;
|
||||
use App\File;
|
||||
use App\Folder;
|
||||
use App\Http\Requests\FileFunctions\RenameItemRequest;
|
||||
use App\User;
|
||||
use ByteUnits\Metric;
|
||||
@@ -59,13 +59,13 @@ class Demo
|
||||
// Get item
|
||||
if ($request->type === 'folder') {
|
||||
|
||||
$item = FileManagerFolder::where('unique_id', $unique_id)
|
||||
$item = Folder::where('unique_id', $unique_id)
|
||||
->where('user_id', 1)
|
||||
->first();
|
||||
|
||||
} else {
|
||||
|
||||
$item = FileManagerFile::where('unique_id', $unique_id)
|
||||
$item = File::where('unique_id', $unique_id)
|
||||
->where('user_id', 1)
|
||||
->first();
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ namespace App\Http\Tools;
|
||||
|
||||
use App;
|
||||
use App\Share;
|
||||
use App\FileManagerFile;
|
||||
use App\FileManagerFolder;
|
||||
use App\File;
|
||||
use App\Folder;
|
||||
use App\Http\Requests\FileFunctions\RenameItemRequest;
|
||||
use App\User;
|
||||
use App\Zip;
|
||||
@@ -38,7 +38,7 @@ class Editor
|
||||
$user_id = is_null($shared) ? Auth::id() : $shared->user_id;
|
||||
|
||||
// Get folder
|
||||
$folder = FileManagerFolder::where('user_id', $user_id)
|
||||
$folder = Folder::where('user_id', $user_id)
|
||||
->where('unique_id', $unique_id)
|
||||
->first();
|
||||
|
||||
@@ -76,7 +76,7 @@ class Editor
|
||||
public static function zip_folder($unique_id, $shared = null)
|
||||
{
|
||||
// Get folder
|
||||
$requested_folder = FileManagerFolder::with(['folders.files', 'files'])
|
||||
$requested_folder = Folder::with(['folders.files', 'files'])
|
||||
->where('unique_id', $unique_id)
|
||||
->where('user_id', Auth::id() ?? $shared->user_id)
|
||||
->with('folders')
|
||||
@@ -217,7 +217,7 @@ class Editor
|
||||
*
|
||||
* @param $request
|
||||
* @param null $shared
|
||||
* @return FileManagerFolder|\Illuminate\Database\Eloquent\Model
|
||||
* @return Folder|\Illuminate\Database\Eloquent\Model
|
||||
*/
|
||||
public static function create_folder($request, $shared = null)
|
||||
{
|
||||
@@ -228,7 +228,7 @@ class Editor
|
||||
$unique_id = get_unique_id();
|
||||
|
||||
// Create folder
|
||||
$folder = FileManagerFolder::create([
|
||||
$folder = Folder::create([
|
||||
'parent_id' => $request->parent_id,
|
||||
'unique_id' => $unique_id,
|
||||
'user_scope' => $user_scope,
|
||||
@@ -284,7 +284,7 @@ class Editor
|
||||
if ($file['type'] === 'folder') {
|
||||
|
||||
// Get folder
|
||||
$folder = FileManagerFolder::withTrashed()
|
||||
$folder = Folder::withTrashed()
|
||||
->with(['folders'])
|
||||
->where('user_id', $user->id)
|
||||
->where('unique_id', $unique_id)
|
||||
@@ -308,7 +308,7 @@ class Editor
|
||||
$child_folders = filter_folders_ids($folder->trashed_folders, 'unique_id');
|
||||
|
||||
// Get children files
|
||||
$files = FileManagerFile::onlyTrashed()
|
||||
$files = File::onlyTrashed()
|
||||
->where('user_id', $user->id)
|
||||
->whereIn('folder_id', Arr::flatten([$unique_id, $child_folders]))
|
||||
->get();
|
||||
@@ -345,7 +345,7 @@ class Editor
|
||||
if ($file['type'] !== 'folder') {
|
||||
|
||||
// Get file
|
||||
$item = FileManagerFile::withTrashed()
|
||||
$item = File::withTrashed()
|
||||
->where('user_id', $user->id)
|
||||
->where('unique_id', $unique_id)
|
||||
->first();
|
||||
@@ -401,7 +401,7 @@ class Editor
|
||||
if ($item['type'] === 'folder') {
|
||||
|
||||
// Move folder
|
||||
$item = FileManagerFolder::where('user_id', $user_id)
|
||||
$item = Folder::where('user_id', $user_id)
|
||||
->where('unique_id', $unique_id)
|
||||
->firstOrFail();
|
||||
|
||||
@@ -412,7 +412,7 @@ class Editor
|
||||
} else {
|
||||
|
||||
// Move file under new folder
|
||||
$item = FileManagerFile::where('user_id', $user_id)
|
||||
$item = File::where('user_id', $user_id)
|
||||
->where('unique_id', $unique_id)
|
||||
->firstOrFail();
|
||||
|
||||
@@ -428,7 +428,7 @@ class Editor
|
||||
*
|
||||
* @param $request
|
||||
* @param null $shared
|
||||
* @return FileManagerFile|\Illuminate\Database\Eloquent\Model
|
||||
* @return File|\Illuminate\Database\Eloquent\Model
|
||||
* @throws \Exception
|
||||
*/
|
||||
public static function upload($request, $shared = null)
|
||||
@@ -523,7 +523,7 @@ class Editor
|
||||
}
|
||||
|
||||
// Return new file
|
||||
return FileManagerFile::create($options);
|
||||
return File::create($options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace App\Http\Tools;
|
||||
|
||||
use App;
|
||||
use App\FileManagerFolder;
|
||||
use App\Folder;
|
||||
use Illuminate\Support\Arr;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ class Guardian
|
||||
public static function check_item_access($requested_id, $shared)
|
||||
{
|
||||
// Get all children folders
|
||||
$foldersIds = FileManagerFolder::with('folders:id,parent_id,unique_id,name')
|
||||
$foldersIds = Folder::with('folders:id,parent_id,unique_id,name')
|
||||
->where('user_id', $shared->user_id)
|
||||
->where('parent_id', $shared->item_id)
|
||||
->get();
|
||||
|
||||
@@ -11,53 +11,7 @@ use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
|
||||
/**
|
||||
* App\FileManagerFile
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $user_id
|
||||
* @property int $unique_id
|
||||
* @property int $folder_id
|
||||
* @property string $thumbnail
|
||||
* @property string|null $name
|
||||
* @property string|null $basename
|
||||
* @property string|null $mimetype
|
||||
* @property string $filesize
|
||||
* @property string|null $type
|
||||
* @property string $user_scope
|
||||
* @property string $deleted_at
|
||||
* @property string $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \App\FileManagerFolder|null $folder
|
||||
* @property-read string $file_url
|
||||
* @property-read \App\FileManagerFolder $parent
|
||||
* @property-read \App\Share|null $shared
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\FileManagerFile onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereBasename($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereFilesize($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereFolderId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereMimetype($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereThumbnail($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereUniqueId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFile whereUserScope($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\FileManagerFile withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\FileManagerFile withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
* @property array|null $metadata
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|FileManagerFile sortable($defaultParameters = null)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|FileManagerFile whereMetadata($value)
|
||||
*/
|
||||
class FileManagerFile extends Model
|
||||
class File extends Model
|
||||
{
|
||||
use Searchable, SoftDeletes , Sortable;
|
||||
|
||||
@@ -85,6 +39,10 @@ class FileManagerFile extends Model
|
||||
'created_at',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
/**
|
||||
* Set routes with public access
|
||||
*
|
||||
@@ -215,7 +173,7 @@ class FileManagerFile extends Model
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo('App\FileManagerFolder', 'folder_id', 'unique_id');
|
||||
return $this->belongsTo('App\Folder', 'folder_id', 'unique_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +183,7 @@ class FileManagerFile extends Model
|
||||
*/
|
||||
public function folder()
|
||||
{
|
||||
return $this->hasOne('App\FileManagerFolder', 'unique_id', 'folder_id');
|
||||
return $this->hasOne('App\Folder', 'unique_id', 'folder_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -237,4 +195,16 @@ class FileManagerFile extends Model
|
||||
{
|
||||
return $this->hasOne('App\Share', 'item_id', 'unique_id');
|
||||
}
|
||||
|
||||
/**
|
||||
* Model events
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -13,55 +13,7 @@ use TeamTNT\TNTSearch\Indexer\TNTIndexer;
|
||||
use \Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
|
||||
/**
|
||||
* App\FileManagerFolder
|
||||
*
|
||||
* @property int $id
|
||||
* @property int|null $user_id
|
||||
* @property int $unique_id
|
||||
* @property int $parent_id
|
||||
* @property string|null $name
|
||||
* @property string|null $type
|
||||
* @property string $user_scope
|
||||
* @property string $deleted_at
|
||||
* @property string $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\FileManagerFolder[] $children
|
||||
* @property-read int|null $children_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\FileManagerFile[] $files
|
||||
* @property-read int|null $files_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\FileManagerFolder[] $folders
|
||||
* @property-read int|null $folders_count
|
||||
* @property-read int $items
|
||||
* @property-read int $trashed_items
|
||||
* @property-read \App\FileManagerFolder $parent
|
||||
* @property-read \App\Share|null $shared
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\FileManagerFolder[] $trashed_children
|
||||
* @property-read int|null $trashed_children_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\FileManagerFile[] $trashed_files
|
||||
* @property-read int|null $trashed_files_count
|
||||
* @property-read \Illuminate\Database\Eloquent\Collection|\App\FileManagerFolder[] $trashed_folders
|
||||
* @property-read int|null $trashed_folders_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder newQuery()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\FileManagerFolder onlyTrashed()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereDeletedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereParentId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereUniqueId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereUserId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\FileManagerFolder whereUserScope($value)
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\FileManagerFolder withTrashed()
|
||||
* @method static \Illuminate\Database\Query\Builder|\App\FileManagerFolder withoutTrashed()
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|FileManagerFolder sortable($defaultParameters = null)
|
||||
*/
|
||||
class FileManagerFolder extends Model
|
||||
class Folder extends Model
|
||||
{
|
||||
use Searchable, SoftDeletes , Sortable;
|
||||
|
||||
@@ -87,6 +39,10 @@ class FileManagerFolder extends Model
|
||||
'created_at',
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
/**
|
||||
* Index folder
|
||||
*
|
||||
@@ -159,7 +115,7 @@ class FileManagerFolder extends Model
|
||||
*/
|
||||
public function parent()
|
||||
{
|
||||
return $this->belongsTo('App\FileManagerFolder', 'parent_id', 'unique_id');
|
||||
return $this->belongsTo('App\Folder', 'parent_id', 'unique_id');
|
||||
}
|
||||
|
||||
public function folderIds()
|
||||
@@ -174,7 +130,7 @@ class FileManagerFolder extends Model
|
||||
*/
|
||||
public function files()
|
||||
{
|
||||
return $this->hasMany('App\FileManagerFile', 'folder_id', 'unique_id');
|
||||
return $this->hasMany('App\File', 'folder_id', 'unique_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -185,7 +141,7 @@ class FileManagerFolder extends Model
|
||||
public function trashed_files()
|
||||
{
|
||||
|
||||
return $this->hasMany('App\FileManagerFile', 'folder_id', 'unique_id')->withTrashed();
|
||||
return $this->hasMany('App\File', 'folder_id', 'unique_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,7 +171,7 @@ class FileManagerFolder extends Model
|
||||
*/
|
||||
public function children()
|
||||
{
|
||||
return $this->hasMany('App\FileManagerFolder', 'parent_id', 'unique_id');
|
||||
return $this->hasMany('App\Folder', 'parent_id', 'unique_id');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -225,7 +181,7 @@ class FileManagerFolder extends Model
|
||||
*/
|
||||
public function trashed_children()
|
||||
{
|
||||
return $this->hasMany('App\FileManagerFolder', 'parent_id', 'unique_id')->withTrashed();
|
||||
return $this->hasMany('App\Folder', 'parent_id', 'unique_id')->withTrashed();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -238,11 +194,15 @@ class FileManagerFolder extends Model
|
||||
return $this->hasOne('App\Share', 'item_id', 'unique_id');
|
||||
}
|
||||
|
||||
// Delete all folder childrens
|
||||
// Delete all folder children
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
});
|
||||
|
||||
static::deleting(function ($item) {
|
||||
|
||||
if ( $item->isForceDeleting() ) {
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
|
||||
@@ -5,25 +5,6 @@ namespace App;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Kyslik\ColumnSortable\Sortable;
|
||||
|
||||
/**
|
||||
* App\Page
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $visibility
|
||||
* @property string $title
|
||||
* @property string $slug
|
||||
* @property string $content
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page sortable($defaultParameters = null)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page whereContent($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page whereTitle($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Page whereVisibility($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Page extends Model
|
||||
{
|
||||
use Sortable;
|
||||
@@ -40,6 +21,4 @@ class Page extends Model
|
||||
];
|
||||
|
||||
public $timestamps = false;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
}
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\PaymentGateway
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $status
|
||||
* @property int $sandbox
|
||||
* @property string $name
|
||||
* @property string $slug
|
||||
* @property string $logo
|
||||
* @property string|null $client_id
|
||||
* @property string|null $secret
|
||||
* @property string|null $webhook
|
||||
* @property string|null $optional
|
||||
* @property int|null $payment_processed
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereClientId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereLogo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereOptional($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway wherePaymentProcessed($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereSandbox($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereSecret($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereSlug($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\PaymentGateway whereWebhook($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class PaymentGateway extends Model
|
||||
{
|
||||
protected $guarded = ['id'];
|
||||
|
||||
public $timestamps = false;
|
||||
}
|
||||
@@ -5,46 +5,20 @@ namespace App;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Notifications\SharedSendViaEmail;
|
||||
use Illuminate\Notifications\Notifiable;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* App\Share
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property string $token
|
||||
* @property int $item_id
|
||||
* @property string $type
|
||||
* @property string|null $permission
|
||||
* @property int $protected
|
||||
* @property string|null $password
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @property-read string $link
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereItemId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share wherePassword($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share wherePermission($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereProtected($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereToken($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereType($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Share whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
* @property int|null $expire_in
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Share whereExpireIn($value)
|
||||
*/
|
||||
class Share extends Model
|
||||
{
|
||||
use Notifiable;
|
||||
use Notifiable;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
|
||||
protected $appends = ['link'];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
/**
|
||||
* Generate share link
|
||||
*
|
||||
@@ -54,4 +28,16 @@ class Share extends Model
|
||||
{
|
||||
return url('/shared', ['token' => $this->attributes['token']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Model events
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,28 +3,29 @@
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* App\Traffic
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $upload
|
||||
* @property int $download
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic whereDownload($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic whereUpload($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|Traffic whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class Traffic extends Model
|
||||
{
|
||||
protected $fillable = ['user_id', 'upload', 'download'];
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'upload',
|
||||
'download'
|
||||
];
|
||||
|
||||
public $incrementing = false;
|
||||
|
||||
protected $keyType = 'string';
|
||||
|
||||
/**
|
||||
* Model events
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
static::creating(function ($model) {
|
||||
$model->id = (string)Str::uuid();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ class User extends Authenticatable
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate uuid
|
||||
* Model Events
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
|
||||
@@ -4,34 +4,6 @@ namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\UserSettings
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $user_id
|
||||
* @property int $storage_capacity
|
||||
* @property string|null $billing_name
|
||||
* @property string|null $billing_address
|
||||
* @property string|null $billing_state
|
||||
* @property string|null $billing_city
|
||||
* @property string|null $billing_postal_code
|
||||
* @property string|null $billing_country
|
||||
* @property string|null $billing_phone_number
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingAddress($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingCity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingCountry($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingName($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingPhoneNumber($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingPostalCode($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereBillingState($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereStorageCapacity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|UserSettings whereUserId($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class UserSettings extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
|
||||
@@ -14,7 +14,7 @@ class Zip extends Model
|
||||
protected $keyType = 'string';
|
||||
|
||||
/**
|
||||
* Generate uuid
|
||||
* Model events
|
||||
*/
|
||||
protected static function boot()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user