mirror of
https://github.com/VueFileManager/vuefilemanager.git
synced 2026-04-28 11:00:39 +00:00
- gate implementation
- protected shared view fix
This commit is contained in:
@@ -1,29 +1,27 @@
|
||||
<?php
|
||||
namespace Support\Demo\Actions;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Illuminate\Http\Request;
|
||||
use Domain\Folders\Models\Folder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
|
||||
class FakeCreateFolderAction
|
||||
{
|
||||
/**
|
||||
* Create new directory
|
||||
* Create new fake folder
|
||||
*/
|
||||
public function __invoke(
|
||||
Request $request
|
||||
): array {
|
||||
return [
|
||||
'user_id' => 1,
|
||||
'id' => Str::uuid(),
|
||||
'parent_id' => random_int(1000, 9999),
|
||||
'name' => $request->input('name'),
|
||||
'type' => 'folder',
|
||||
'author' => $request->user() ? 'user' : 'visitor',
|
||||
'items' => '0',
|
||||
'color' => $request->input('icon.color') ?? null,
|
||||
'emoji' => $request->input('icon.emoji') ?? null,
|
||||
'updated_at' => now()->format(__t('time')),
|
||||
'created_at' => now()->format(__t('time')),
|
||||
];
|
||||
): Collection | Model {
|
||||
return Folder::factory()
|
||||
->make([
|
||||
'name' => $request->input('name'),
|
||||
'author' => $request->user() ? 'user' : 'visitor',
|
||||
'color' => $request->input('icon.color') ?? null,
|
||||
'emoji' => $request->input('icon.emoji') ?? null,
|
||||
'updated_at' => now()->format(__t('time')),
|
||||
'created_at' => now()->format(__t('time')),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ class FakeUploadFileAction
|
||||
|
||||
return [
|
||||
'id' => Str::uuid(),
|
||||
'folder_id' => $request->input('parent_id'),
|
||||
'parent_id' => $request->input('parent_id'),
|
||||
'thumbnail' => $thumbnail,
|
||||
'name' => $file->getClientOriginalName(),
|
||||
'basename' => $filename,
|
||||
|
||||
@@ -251,14 +251,11 @@ if (! function_exists('is_demo')) {
|
||||
|
||||
if (! function_exists('is_demo_account')) {
|
||||
/**
|
||||
* Check if is demo
|
||||
*
|
||||
* @param $email
|
||||
* @return mixed
|
||||
* Check if is demo environment
|
||||
*/
|
||||
function is_demo_account($email)
|
||||
function is_demo_account(): bool
|
||||
{
|
||||
return config('vuefilemanager.is_demo') && $email === 'howdy@hi5ve.digital';
|
||||
return config('vuefilemanager.is_demo') && auth()->user()->email === 'howdy@hi5ve.digital';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -559,9 +556,9 @@ if (! function_exists('filter_folders_ids')) {
|
||||
*/
|
||||
function filter_folders_ids($folders, $by_column = 'id')
|
||||
{
|
||||
$folder_ids = recursiveFind($folders->toArray(), $by_column);
|
||||
$parent_ids = recursiveFind($folders->toArray(), $by_column);
|
||||
|
||||
return appeared_once($folder_ids);
|
||||
return appeared_once($parent_ids);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user