I'm using Laravel 7 and Visual Code. My Logout Controller have a problem but the code work when i run. What's the problem?
<?php namespace App\Http\Controllers\Auth; use App\Http\Controllers\Controller; use Illuminate\Http\Request; class LogoutController extends Controller { public function __invoke(Request $request) { auth()->logout(); return redirect('/'); } }
Error in my VSCode is
Undefined method 'logout'. intelephense(1013) [18,17]
It's a bug? or my fault? Thankslal
Hey!
Nothing to worry about. Your IDE is just not able to find the method event though it's there.
You can also try to logout using the Auth Facade directly like this:
\Auth::logout();
There are a few occurrences where magic methods can not be resolved eg. when they are behind Facades or likewise.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community