jeudi 2 janvier 2020

Laravel 5.8 403 This action is unauthorized

I have update method like this

  public function update(Contact  $contact)
{

    $this->authorize('ownItems', $contact);
    ......
}

and ContactPolicy :

public function ownItem(User $user,Contact $contact)
{
  return true;
} 

It work correctly but when I replace Contcact to ContactRequest in my update method show me this :

403 This action is unauthorized.

update method :

public function update(ContactRequest  $contact)
{
    $this->authorize('ownItems', $contact);
    .......
}

authorize method in ContactRequest:

public function authorize()
{
    return true;
}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MN8ium
via IFTTT

Aucun commentaire:

Enregistrer un commentaire