F
Filament7mo ago
Blaze

Activity logs can be seen by all roles

I just implemented filament logger by z3dox and it seems that the logs can be seen by all roles, how can i make it only viewable by Super Admins? Im using filament shield for the roles. Im also using Acitvity logger by Dennis Koch
Solution:
Gate::policy(Activity::class, ActivityPolicy::class);
Gate::policy(Activity::class, ActivityPolicy::class);
...
Jump to solution
7 Replies
Blaze
BlazeOP7mo ago
i tried it but it doesn't work i have generated the policy
krekas
krekas7mo ago
If you would show the code...
Blaze
BlazeOP7mo ago
this is my code
Vp
Vp7mo ago
Did you put like below in AppServiceProvider (assuming you are on L-11)?
Solution
Vp
Vp7mo ago
Gate::policy(Activity::class, ActivityPolicy::class);
Gate::policy(Activity::class, ActivityPolicy::class);
Blaze
BlazeOP7mo ago
<?php

namespace App\Providers;

use App\Models\Activity;
use App\Policies\ActivityPolicy;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
Gate::policy(Activity::class, ActivityPolicy::class);
}
}
<?php

namespace App\Providers;

use App\Models\Activity;
use App\Policies\ActivityPolicy;
use Illuminate\Support\Facades\Gate;
use Illuminate\Support\ServiceProvider;

class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*/
public function register(): void
{
//
}

/**
* Bootstrap any application services.
*/
public function boot(): void
{
Gate::policy(Activity::class, ActivityPolicy::class);
}
}
should i put it like this? thanks its working
Want results from more Discord servers?
Add your server