How to make authorization in laravel 5.5?

How to make authorization in laravel 5.5?
That's what I do:
public function register(Request $request)
{
 if ($request->isMethod('post'))
{
 $email = Input::get('email');
 $password = Input::get('password');
 $exist = User::where('email', $email)->get();
 if ($exist->isEmpty())
{
 $user = new User;
 $user->email = $email;
 $user->password_hash = Hash::make($password);
date_default_timezone_set('Asia/Krasnoyarsk');
 $user->created_at = date('Y-m-d H:i:s');
 $user->auth = md5(date('Y-m-d H:i:s') . 'salt');
 $user->money = 600;
$user->save();
 $auth = Auth::attempt(['email' => $email, 'password' => $password]);
var_dump($auth);
 } else
{
 return view('register', ['error' => 'This email is already registered!']);
}
 } else
{
 return view('register');
}
}

The User Model:
<?php

namespace App;

use Illuminate\Notifications\is a notifiable;
use Illuminate\Foundation\Auth\Authenticatable as User;
use Zizaco\Entrust\Traits\EntrustUserTrait;

class User extends Authenticatable
{
 protected $table = 'users';
 public $timestamps = false;
}</property-->
<br / > String Auth::attempt(['email' => $email, 'password' => $password]); returns always false.<br> Probably something wrong in the config, but I don't know what.<br> Config:<br><pre><code><?php return [ /* |-------------------------------------------------------------------------- | Authentication Defaults |-------------------------------------------------------------------------- | | This option controls the default authentication "guard" and password | reset options for your application. You may change these defaults | as required, but they're a perfect start for most applications. | */ 'defaults' =--> [ 'guard' => 'web', 'passwords' => 'users', ], /* |-------------------------------------------------------------------------- | Authentication Guards |-------------------------------------------------------------------------- | | Next, you may define every authentication guard for your application. | Of course, a great default configuration has been defined for you | here which uses session storage and the Eloquent user provider. | | All auth drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | Supported: "session", "token" | */ 'guards' => [ 'web' => [ 'driver' => 'session', 'provider' => 'users', ], 'api' => [ 'driver' => 'token', 'provider' => 'users', ], ], /* |-------------------------------------------------------------------------- | User Providers |-------------------------------------------------------------------------- | | All auth drivers have a user provider. This defines how the | users are actually retrieved out of your database or other storage | mechanisms used by this application to persist your user's data. | | If you have multiple user tables or models you may configure multiple | sources which represent each model / table. These sources may then | be assigned to any extra authentication guards you have defined. | | Supported: "database", "eloquent" | */ 'providers' => [ 'users' => [ 'driver' => 'eloquent', 'model' => App\User::class, ], // 'users' => [ // 'driver' => 'database', // 'table' => 'users', // ], ], /* |-------------------------------------------------------------------------- | Resetting Passwords |-------------------------------------------------------------------------- | | You may specify multiple password reset configurations if you have more | than one user table or model in the application and you want to have | separate the password reset settings based on the specific user types. | | The expire time is the number of minutes that the reset token should be | considered valid. This security feature keeps tokens short-lived so | they have less time to be guessed. You may change this as needed. | */ 'passwords' => [ 'users' => [ 'provider' => 'users', 'table' => 'password_resets', 'expire' => 60, ], ], ];</code></pre><br> Migration:<br><pre><code><?php use Illuminate\Support\Facades\Schema; use Illuminate\Database\Schema\Blueprint; use Illuminate\Database\Migrations\Migration; class Users extends Migration { /** * Run the migrations. * * @return void */ public function up() { Schema::create('users', function (Blueprint $table) { $table--->increments('id'); $table->string('email')->unique(); $table->string('password_hash', 60); $table->string('created_at', 19); $table->string('auth', 32); $table->string('remember_token', 100)->nullable(); $table->string('confirmed_at', 19)->nullable(); $table->integer('money')->nullable(); $table->string('name')->nullable(); $table->string('fname')->nullable(); $table->string('nick')->nullable(); $table->string('last_visit', 19)->nullable(); $table->integer('avatar')->nullable(); }); } /** * Reverse the migrations. * * @return void */ public function down() { Schema::dropIfExists('users'); } }</code></pre>
June 10th 19 at 14:50
2 answers
June 10th 19 at 14:52
Solution
I should have just.
Found a solution, maybe someone will be useful.
https://stackoverflow.com/questions/26073309/how-t...

The bottom line is that if you have a field with password is for others to add to the file User.php function
public function getAuthPassword()
{
 return $this->password_hash;
}

Function changed in my example. Good luck!
June 10th 19 at 14:54
There is everything from the box works is that you are trying to do?
https://laravel.com/docs/5.5/authentication
A link to the documentation - graham commented on June 10th 19 at 14:57

Find more questions by tags Laravel