Why not add role shiled for dashborad page

No description
21 Replies
Vp
Vp9mo ago
Because of config file.
Alnuaimi
AlnuaimiOP9mo ago
whats is the errror
No description
Vp
Vp9mo ago
Scroll down and check exclude
No description
Alnuaimi
AlnuaimiOP9mo ago
the same you
No description
Vp
Vp9mo ago
Because that exclude.pages.Dashboard answer your question "Why not add role shiled for dashborad page". Based on the config file, you're excluded "Dashboard" inside 'pages' for permissions/roles
Alnuaimi
AlnuaimiOP9mo ago
Forget it,Now I thises widgets when unselect the role not work why?
No description
Alnuaimi
AlnuaimiOP9mo ago
No description
Vp
Vp9mo ago
It's difficult to answer by just looking some photos
Alnuaimi
AlnuaimiOP9mo ago
my widgets The permissions do not apply to it. When I select or deselect, nothing happens
Vp
Vp9mo ago
Did you put HasWidgetShield traits?
Alnuaimi
AlnuaimiOP9mo ago
No
Alnuaimi
AlnuaimiOP9mo ago
No description
Alnuaimi
AlnuaimiOP9mo ago
Why not hide class StatsOverviewWidget ?
No description
Vp
Vp9mo ago
Add what you want to hide inside "widgets" in this config
Alnuaimi
AlnuaimiOP9mo ago
How?
Vp
Vp9mo ago
The easiest way to be by "typing..." anyhow try like below
'widgets' => [
'AccountWidget',
'FilamentInfoWidget',
'StatsOverviewWidget', // this should be same as the class name
],
'widgets' => [
'AccountWidget',
'FilamentInfoWidget',
'StatsOverviewWidget', // this should be same as the class name
],
Alnuaimi
AlnuaimiOP9mo ago
No, no, brother, I mean I want the permissions to apply to it StatsOverviewWidget and I do not hide that
Vp
Vp9mo ago
No idea bro, suggested you to ask in #bezhansalleh-shield
Sandeep
Sandeep7d ago
When I have giving permission with this command:
php artisan shield:generate --all --option=permissions
php artisan shield:generate --all --option=permissions
I am getting error like this (See the screenshot): code:
<?php

namespace App\Filament\Widgets;

use App\Models\Product;
use BezhanSalleh\FilamentShield\Traits\HasWidgetShield;
use Filament\Notifications\Notification;
use Filament\Widgets\Widget;
use Illuminate\Support\Facades\Artisan;

class StatusReport extends Widget
{
use HasWidgetShield;
protected static string $view = 'filament.widgets.status-report';

protected static ?int $sort = 1;
protected static ?string $title = 'Finance dashboard';

public int $errorCount = 0;

public function mount(): void
{
$this->errorCount = Product::where('is_error', true)->count();
}

public function download(): void
{
if ($this->errorCount > 0) {
sleep(3);
Notification::make('fix_error')
->title('Product sync has begun.')
->body('After some time, please refresh the page.')
->info()
->send();
Artisan::call('fix-product-errors-based-on-general-logs');
} else {
sleep(3);
Notification::make('fix_error')
->title('There are no errors.')
->danger()
->send();
}
// return response()->redirectToRoute('download-status-report');
}
}
<?php

namespace App\Filament\Widgets;

use App\Models\Product;
use BezhanSalleh\FilamentShield\Traits\HasWidgetShield;
use Filament\Notifications\Notification;
use Filament\Widgets\Widget;
use Illuminate\Support\Facades\Artisan;

class StatusReport extends Widget
{
use HasWidgetShield;
protected static string $view = 'filament.widgets.status-report';

protected static ?int $sort = 1;
protected static ?string $title = 'Finance dashboard';

public int $errorCount = 0;

public function mount(): void
{
$this->errorCount = Product::where('is_error', true)->count();
}

public function download(): void
{
if ($this->errorCount > 0) {
sleep(3);
Notification::make('fix_error')
->title('Product sync has begun.')
->body('After some time, please refresh the page.')
->info()
->send();
Artisan::call('fix-product-errors-based-on-general-logs');
} else {
sleep(3);
Notification::make('fix_error')
->title('There are no errors.')
->danger()
->send();
}
// return response()->redirectToRoute('download-status-report');
}
}
Permission is created to permissions table: (See the screenshot) Could any help me for the same?
No description
Sandeep
Sandeep7d ago
No description
Want results from more Discord servers?
Add your server