Level 63
Please write your code between backtits.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hi,
I have a problem with controller right know : 'Call to undefined method App\Http\Controllers\AccountController::middleware()'
class AccountController extends Controller { public function __construct(){ $this->middleware('auth'); } }
Anyone has an idea ? Thank you for your help !
Your base controller class needs to extend Laravel's Illuminate\Routing\Controller to use the middleware method.
<?php
use Illuminate\Routing\Controller as BaseController;
class Controller extends BaseController
{ }
The default base controller in App\Http\Controllers\Controller should already do that.
Please or to participate in this conversation.