S
S
sozanadone2016-04-19 18:48:57
Laravel
sozanadone, 2016-04-19 18:48:57

How to make custom authorization on laravel 5.2?

Hello everyone, just started learning laravel.
I want to make custom authorization. It is necessary to authorize by 3 fields:
City/Login/Password
1. Executed php artisan make:auth
2. In routes.php I registered Route::post('/login', 'Auth\[email protected]');
3. In AuthController.php I created a function public function postLogin(Request $request) {...}
But when I try to follow the guides on the Internet, I run into errors.
I tried to check like this: if ($this->auth->attempt( $credentials, $remember))
I get Undefined property: App\Http\Controllers\Auth\AuthController::$auth
Tried like this: if (Auth::attempt($credentials, $remember))
I get Fatal error: Class 'App\ Http\Controllers\Auth\Auth' not found
Tell me what I don't understand? thank!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Izmailov, 2016-04-19
@sozanadone

It is written to you on a paper - the class is not found.
Used \ - before global functions

\Auth::some()
\Request::some()

and in this spirit, or set them directly in the file:
and then in the code it will be possible to write directly:
Auth::some()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question