Mepha
Mepha
FFilament
Created by Mepha on 10/13/2024 in #❓┊help
Allow view without view_any
I end up doing this BookResource.php
public static function canAccess(array $parameters = []): bool
{
$user = auth()->user();
return $user->can('view_book') && !$user->can('view_any_book');
}
public static function canAccess(array $parameters = []): bool
{
$user = auth()->user();
return $user->can('view_book') && !$user->can('view_any_book');
}
ViewBook.php
public static function canAccess(array $parameters = []): bool
{
return auth()->user()->can('view_book');
}
public static function canAccess(array $parameters = []): bool
{
return auth()->user()->can('view_book');
}
ListBooks.php
public static function canAccess(array $parameters = []): bool
{
return auth()->user()->can('view_any_book');
}
public static function canAccess(array $parameters = []): bool
{
return auth()->user()->can('view_any_book');
}
3 replies