class BelongsToUserScope implements Scope{ /** * Apply the scope to a given Eloquent query builder. */ public function apply(Builder $builder, Model $model): void { if (auth()->check() && ! auth()->user()->isAdmin() || Filament::getCurrentPanel()->getId() == 'app') { $builder->where('user_id', auth()->id()); } }}