Подскажите. Почему не выполняется авторизация юзера?
Выдает ошибку. Trying to get property of non-object (View: /Applications/MAMP/htdocs/blog/resources/views/vendor/header.blade.php)
User.php
<?php namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
public $timestamps = false;
protected $table = 'users';
protected $fillable = ['','firstname','lastname','login','password','email','phone','adress','signup-date','total-orders','activated','type'];
protected $hidden = [
'password', 'remember_token',
];
public function orders()
{
return $this->belongsToMany('App\Product', 'orders')->withPivot('id','count','total','date');
}
}
Login.blade.php
<form action="#" id="sign-in">
<input type="text" name="email" class="input" placeholder="Логин">
<input type="password" name="password" class="input" placeholder="Пароль">
<input type="hidden" name="_token" value="{{ csrf_token() }}">
<div class="flex-sb">
<input type="submit" class="input-submit" value="Войти">
<span class="blue-link">Забыли пароль?</span>
</div>
</form>
routes.php
Route::post('login', function () {
$user = array(
'email' => Input::get('email'),
'password' => Input::get('password')
);
if (Auth::attempt($user)) {
return Redirect::route('home')
->with('flash_notice', 'You are successfully logged in.');
}
// authentication failure! lets go back to the login page
return Redirect::route('login')
->with('flash_error', 'Your username/password combination was incorrect.')
->withInput();
});