Differnt Admins with Differnt Content using Filament

26 Views Asked by At

I'm working with Laravel, and Filament Admin panel. I have differnt admin and each admin has differnt complaints based on the company he registred on.

the complaints table get well but when i want to edit on of them it always choose the first item, and this happend in other resources.

$user = auth()->user();
if ($user->super_admin) {
    return  $query;
}
$company = Employee::where('user_id',$user->id)->first()->company;
foreach ($company->branches()->get() as $branch) {
    $query = $query->orWhere('branch_id','=', $branch->id);
}
return $query;

it's return the complaints based on it's branch id and it's work but when I tap on one of them it always go to edit the same one and if a remove this code it works will.

0

There are 0 best solutions below