|
@@ -48,7 +48,6 @@ class DepartmentController extends Controller
|
|
|
}
|
|
|
|
|
|
|
|
|
-
|
|
|
public function update(CreateOrUpdateRequest $request,string $id)
|
|
|
{
|
|
|
$department=Department::findOrFail($id);
|
|
@@ -70,4 +69,15 @@ class DepartmentController extends Controller
|
|
|
|
|
|
return $this->noContent();
|
|
|
}
|
|
|
+
|
|
|
+ public function departmentUserIndex(){
|
|
|
+ $companyId=Auth::user()->company_id;
|
|
|
+ $department=Department::query()->where('company_id',$companyId)->with(['users'=>function($query){
|
|
|
+ $query->select('id','name','department_id');
|
|
|
+ }])->get(['id','name','parent_id']);
|
|
|
+ return $this->success([
|
|
|
+ 'data' => make_tree($department->toArray())
|
|
|
+ ]);
|
|
|
+
|
|
|
+ }
|
|
|
}
|