Ad
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;
}
Ad
Answer
ContactRequest
is a laravel Request
class instance
public function update(ContactRequest $request,Contact $contact)
{
$this->authorize('ownItems', $contact);
.......
}
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad