F
Filament2mo 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
Blaze2mo ago
i tried it but it doesn't work i have generated the policy
krekas
krekas2mo ago
If you would show the code...
Blaze
Blaze2mo ago
this is my code
Vp
Vp2mo ago
Did you put like below in AppServiceProvider (assuming you are on L-11)?
Solution
Vp
Vp2mo ago
Gate::policy(Activity::class, ActivityPolicy::class);
Gate::policy(Activity::class, ActivityPolicy::class);
Blaze
Blaze2mo 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
More Posts
How can I call form of one resource from another resource ?Is it possible to share form of one resource to another resource?RouteNotFoundException FilamentWhy in filament route not found ? When I run command php artisan route:clear it didn’t fixed error .Generate PDF From Collection Relation Manager ( Step By Filament Daily)hi all, i create action to export data from relation manager . im trying to follow step according wThe error appeared suddenly. What's the solution?ًThe error appeared suddenly. What's the solution?is it possible to get model name inside resource?is it possible to get model name inside resource? i want to get model name and query it like this ``With a create action can I create data form one resource table for another resource.Example: I have a User model and Job Model, I want to create job record form User table action. But notification inside action not showingi have code action like this but when it create, the success notification not fired how to tackle this it possible to use mutateFormDataUsing inside createOptionFormbased on the title, is it possible to use mutateFormDataUsing inside createOptionForm? How to achiveSpatieMediaLibraryFileUpload inside a RepeaterHello, I have a model pages, model pages have a json column that I call cf. Each page has a differen3.2.79 appears to have broken Select that aren't multiple (Not sure if this is specific to Shield)In 3.2.78 this worked fine `Forms\Components\Select::make('roles')->label('User Role')->relationship