namespaces refactoring part 3

This commit is contained in:
Peter Papp
2021-07-19 13:40:26 +02:00
parent 54dc57fcbf
commit 29d1b68dd5
26 changed files with 126 additions and 65 deletions

View File

@@ -258,9 +258,12 @@ if (! function_exists('get_item')) {
*/
function get_item($type, $id)
{
$model = strtolower($type) === 'folder' ? 'Folder' : 'File';
$namespace = match ($type) {
'folder' => 'Domain\\Folders\\Models\\Folder',
'file' => 'Domain\\Files\\Models\\File',
};
return ("App\\Models\\$model")::find($id);
return ($namespace)::find($id);
}
}