Remove redundant Company::scopeCompanyables wrapper

This commit is contained in:
Marcus Moore 2023-08-07 16:54:23 -07:00
parent f7b2075e9e
commit 7c5a1b376e
No known key found for this signature in database

View file

@ -27,7 +27,7 @@ class DepartmentsController extends Controller
$this->authorize('view', Department::class); $this->authorize('view', Department::class);
$allowed_columns = ['id', 'name', 'image', 'users_count']; $allowed_columns = ['id', 'name', 'image', 'users_count'];
$departments = Company::scopeCompanyables(Department::select( $departments = Department::select(
'departments.id', 'departments.id',
'departments.name', 'departments.name',
'departments.phone', 'departments.phone',
@ -37,8 +37,8 @@ class DepartmentsController extends Controller
'departments.manager_id', 'departments.manager_id',
'departments.created_at', 'departments.created_at',
'departments.updated_at', 'departments.updated_at',
'departments.image'), 'departments.image'
"company_id", "departments")->with('users')->with('location')->with('manager')->with('company')->withCount('users as users_count'); )->with('users')->with('location')->with('manager')->with('company')->withCount('users as users_count');
if ($request->filled('search')) { if ($request->filled('search')) {
$departments = $departments->TextSearch($request->input('search')); $departments = $departments->TextSearch($request->input('search'));