cant hide depending on the role in my policy
Hi how can i hide the activity log depending on the role of the user?
i tried in appserviceprovider.php but no luck.
activitypolicy.php
<?php
namespace App\Policies;
use App\Models\Activity;
use App\Models\User;
use Illuminate\Auth\Access\Response;
class ActivityPolicy
{
/
* Determine whether the user can view any models.
*/
public function viewAny(User $user): bool
{
return $user->isEditor();
}
/
* Determine whether the user can view the model.
*/
public function view(User $user, Activity $activity): bool
{
return $user->isEditor();
}
appserviceprovider.php
?php
namespace App\Providers;
use Filament\Facades\Filament;
use Illuminate\Support\ServiceProvider;
use Filament\Navigation\NavigationItem;
use App\Policies\ActivityPolicy;
use Spatie\Activitylog\Models\Activity;
class AppServiceProvider extends ServiceProvider
{
protected $policies = [
// Update
Activity::class
with the one defined in config/activitylog.php
Activity::class => ActivityPolicy::class,
];
/**0 Replies