trash api update

This commit is contained in:
Čarodej
2022-05-03 07:47:54 +02:00
parent 4f9fb3991c
commit 0f42704980
6 changed files with 111 additions and 94 deletions

View File

@@ -332,7 +332,7 @@ if (! function_exists('get_item')) {
/**
* Get folder or file item
*/
function get_item(string $type, string $id): Folder | File
function get_item(string $type, string $id): File|Folder
{
$model = $type === 'folder'
? 'folder'
@@ -343,7 +343,15 @@ if (! function_exists('get_item')) {
'file' => 'Domain\\Files\\Models\\File',
};
return ($namespace)::find($id);
// Get item
$entry = ($namespace)::withTrashed()
->find($id);
if (!$entry) {
abort(response()->json(entryNotFoundError()), 404);
}
return $entry;
}
}