Laravel authorize() Error? You’re Missing This One Thing!
May 24, 2024
Laravel Call to undefined method App\Http\Controllers\YourController::authorize()
Our error:
Call to undefined method App\Http\Controllers\YourController::authorize()
Solution:
Add namespace:
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
Next in our Controller add use
statement
use AuthorizesRequests;
It should work now.
Why is that error even there?
Probably your controller does not extend the Laravel `App\Http\Controllers`.
Reach out to me! Find me on linkedin!
Want to stay updated? Join my newsletter and get a weekly report on the most exciting industry news! 🚀