Extend App\Http\Controllers\Controller instead Illuminate\Routing\Controller;
anandiamy opened this issue · 2 comments
anandiamy commented
Sometimes we want to use Policy in Controller
https://laravel.com/docs/5.8/authorization#via-controller-helpers
If we use Illuminate\Routing\Controller, there is an exception
Method authorize() does not exists
So, I think we must use App\Http\Controllers\Controller
instead Illuminate\Routing\Controller
uyab commented
You just need to use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
in your controller.
class FaqController extends Controller
{
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
}
anandiamy commented
Oh I see