What seems to be the problem:
My form authorisation is not working when I submit the form
Whenever I submit my form I get a 403 error. My policy works if the form is submitted using laravel collective with screen refresh but not if I use livewire
Steps to Reproduce:
Are you using the latest version of Livewire:
2.2
Do you have any screenshots or code examples:
public function store()
{
if ($this->action == 'add')
{
$this->authorize('create', 'App\Models\Content');
} else {
$this->authorize('update', $this->content);
}
$this->validate($this->rules, $this->messages);
...
}
My policies are declared like this:
public function create(Admin $admin)
{
return $admin->hasPermissionTo('content-create');
}
public function update(Admin $admin)
{
return $admin->hasPermissionTo('content-edit');
}
I added dd(“authorisation check”) in the constructor of the policy and it triggered whenever I submit the form which seem to be a good think as it is looking in the right pace. But for some reason, the create and update policy don’t work
When the form is submitted