- mark folder as team folder after folder was created

- show members in spotlight search
This commit is contained in:
Čarodej
2021-11-04 09:14:12 +01:00
parent 5a9f2985c9
commit aec5b98313
15 changed files with 121 additions and 40 deletions

View File

@@ -9,19 +9,33 @@ use Domain\Folders\Requests\CreateFolderRequest;
class CreateFolderAction
{
/**
* Create new directory
* Create new folder
*/
public function __invoke(
CreateFolderRequest $request,
?Share $shared = null,
): Folder | array {
): Folder|array {
/*
* check if exist parent team folder, if yes,
* then get folder to detect whether it is team_folder
*/
if ($request->has('parent_id')) {
$isTeamFolder = Folder::find(
$request->input('parent_id')
)
->getLatestParent()
->team_folder;
}
// Create folder record
return Folder::create([
'parent_id' => $request->input('parent_id'),
'name' => $request->input('name'),
'color' => $request->input('color') ?? null,
'emoji' => $request->input('emoji') ?? null,
'author' => $shared ? 'visitor' : 'user',
'user_id' => $shared ? $shared->user_id : Auth::id(),
'parent_id' => $request->input('parent_id'),
'name' => $request->input('name'),
'color' => $request->input('color') ?? null,
'emoji' => $request->input('emoji') ?? null,
'author' => $shared ? 'visitor' : 'user',
'user_id' => $shared ? $shared->user_id : Auth::id(),
'team_folder' => $isTeamFolder ?? false,
]);
}
}