controller refactoring part 1

This commit is contained in:
Peter Papp
2021-07-20 08:58:20 +02:00
parent 29d1b68dd5
commit d6db2f3a7c
25 changed files with 717 additions and 546 deletions
@@ -0,0 +1,25 @@
<?php
namespace Domain\Folders\Controllers;
use Domain\Folders\Models\Folder;
use Illuminate\Support\Facades\Auth;
class NavigationFolderTreeController
{
public function __invoke(): array
{
$folders = Folder::with('folders:id,parent_id,id,name')
->where('parent_id', null)
->where('user_id', Auth::id())
->sortable()
->get(['id', 'parent_id', 'id', 'name']);
return [
[
'name' => __t('home'),
'location' => 'base',
'folders' => $folders,
],
];
}
}