$user !== null && $user->can(CrudPermission::VIEW->format(Feature::class)), fn (): bool => Filament::isServing() ? $user !== null && $user->can(CrudPermission::VIEW->format(Feature::class)) : true ); } /** * Determine whether the user can view the model. * * @param User|null $user * @param Feature $feature * @return bool */ public function view(?User $user, Feature $feature): bool { return Nova::whenServing( fn (): bool => $user !== null && $user->can(CrudPermission::VIEW->format(Feature::class)), fn (): bool => Filament::isServing() ? $user !== null && $user->can(CrudPermission::VIEW->format(Feature::class)) : $feature->isNullScope() ); } /** * Determine whether the user can create models. * * @param User $user * @return bool */ public function create(User $user): bool { return $user->can(CrudPermission::CREATE->format(Feature::class)); } /** * Determine whether the user can update the model. * * @param User $user * @return bool */ public function update(User $user): bool { return $user->can(CrudPermission::UPDATE->format(Feature::class)); } /** * Determine whether the user can delete the model. * * @param User $user * @return bool */ public function delete(User $user): bool { return $user->can(CrudPermission::DELETE->format(Feature::class)); } }