F
Filament12mo ago
Kuldeep

403 forbidden error

I'm trying to add a modal action to the custom page. When clicking on the button it'll go to 403 forbidden error every time. Any solution for the same?
8 Replies
Dennis Koch
Dennis Koch12mo ago
Share some info with us. Probably you set some policies that prevent showing the page
Kuldeep
KuldeepOP12mo ago
I have this type of code and tried it with the filament resource custom page. But it'll go to 403 whenever I click on the "Set Status" button. I've checked for permission and it's already given.
<?php

namespace App\Filament\Pages;

use App\Filament\Resources\JobsResource;
use Filament\Forms\Components\Textarea;
use Filament\Pages\Actions\ViewAction;
use Filament\Pages\Page;
use Filament\Pages\Actions;

class JobFiles extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.job-files';

protected function getActions(): array
{
return [
ViewAction::make('view')
->label('Go to Job Details')
->url('Link'),
Actions\Action::make('set_status')
->label('Set Status')
->modalWidth('sm')
->modalHeading(__('Set Status'))
->modalButton(__('SET STATUS'))
->form([
Textarea::make('status_note')
->label(__('Status Note'))
->rows(3),
])
->action(function (array $data) use (): void {

}),
];
}

protected static function shouldRegisterNavigation(): bool
{
return false;
}
}
<?php

namespace App\Filament\Pages;

use App\Filament\Resources\JobsResource;
use Filament\Forms\Components\Textarea;
use Filament\Pages\Actions\ViewAction;
use Filament\Pages\Page;
use Filament\Pages\Actions;

class JobFiles extends Page
{
protected static ?string $navigationIcon = 'heroicon-o-document-text';

protected static string $view = 'filament.pages.job-files';

protected function getActions(): array
{
return [
ViewAction::make('view')
->label('Go to Job Details')
->url('Link'),
Actions\Action::make('set_status')
->label('Set Status')
->modalWidth('sm')
->modalHeading(__('Set Status'))
->modalButton(__('SET STATUS'))
->form([
Textarea::make('status_note')
->label(__('Status Note'))
->rows(3),
])
->action(function (array $data) use (): void {

}),
];
}

protected static function shouldRegisterNavigation(): bool
{
return false;
}
}
@Dennis Koch @toeknee Any solution for this?
toeknee
toeknee12mo ago
Please do note tag people as per #✅┊rules You are getting a 403 as you are not authorised to update it. Please check your Policy for JobFiles
Kuldeep
KuldeepOP12mo ago
Sorry for tag! Let me check once.
LeandroFerreira
LeandroFerreira12mo ago
it doesn't make sense if the action is empty
toeknee
toeknee12mo ago
It doesn't but it doesn't effect the 403. I ssuepct it's been removed for testing purposes.
awcodes
awcodes12mo ago
i think we need to see the action callback. based on what is shown in the code, the Action would just open a modal with a form in it.
LeandroFerreira
LeandroFerreira12mo ago
I think the same
Want results from more Discord servers?
Add your server