I have a Publication model and a PublicationPolicy policy. In my controller, I'm using the following:
$this->authorize('update', $pub);
On the policy I have the following:
public function update(User $user, Publication $publication)
{
dd($user);
}
Instead of dying with the user output, I get an error message saying "This action is unauthorized."
I have registered the policy in AuthServiceProvider like so:
protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy',
Publication::class => PublicationPolicy::class,
];
Another point to mention is that the policy's before function seems to work just fine. It's the individual calls to abilities that is not working.
Help?