records based on roles
hi i want in resource if user has client role just see the record that belongs to him and if user has the role of operator see all records can any one help me?
6 Replies
Overwrite
getEloquentQuery()
on the Resource.Could not check compatibility between App\Filament\Resources\AsnadResource::getEloquentQuery(): App\Filament\Resources\Builder and Filament\Resources\Resource::getEloquentQuery(): Illuminate\Database\Eloquent\Builder, because class App\Filament\Resources\Builder is not available
i want to do this but i get this error
and when i use use Illuminate\Database\Eloquent\Builder;
i get this Class "App\Filament\Resources\AsnadResource\Pages\Actions\CreateAction" not found
i'm sorry
You didn't import the builder.
You can't just add code. You need to make sure it uses the right classes
is this modifi correct return static::getModel()::query()->where('user_id', Auth::user()->id);
you right
try this
thank you