I want to know how methods are declared in Laravel’s facades. For example, I want to create a user-defined function to index my login page. Firstly, I need to check whether the user is already authenticated. To do that, I will use Laravel’s Auth facade.
public function indexLogin() {
if (Auth::check()) {
return redirect('/mainpage');
}
}
But, when I wanted to learn more about this method, the only thing I came across were declarations made in the PHPDoc section.
/*
*
* @method static bool check()
*
*/
For this case, I know what the method does but also want to know how it works. I believe the declarations that were made in PHPDoc sections are not enough to run methods.
I checked Laravel’s official documentation but found nothing.
2
Answers
You see at the end of the methods declaration, before the class name declaration there is a PHPDoc :
you can check them to know how the method works.
In the documentation, you can see where the methods come from as pointed out by @xenooooo.
by digging a bit, you cas see that
check()
is usinguser()