I just created a new project of laravel version 5.5 with the laravel installer.And run the command \"php artisan make:auth\".The views and controller are generated
Sorry for Answering later I had same problem after searching on the internet found two solutions
1-Add
@csrf
or
<input type="hidden" name="_token" value="{{ csrf_token() }}">
inside your form if missing
2:if you opened you login page for long time and didn't logged in. just refresh the browser or press ctrl+F5
Add csrf token
<input type="hidden" name="_token" value="{{ csrf_token() }}">
try this one in your global handler app/Exceptions/Handler.php
public function render($request, Exception $e)
{
if ($e instanceof \Illuminate\Session\TokenMismatchException) {
return redirect('/login');
}
return parent::render($request, $e);
}
Make sure your User.php model exist in app folder and fields must be define in this model.
<?php
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'name', 'email', 'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password', 'remember_token',
];
}
Hi for the group paths that you want to apply to everyone, use this method, which is my 5.5 larval version. Use the star => go to app/Http/Middleware/VerifyCsrfToken and add
protected $except = [
'/user/*'
];
This is also my user's path
Route::group(['prefix' => 'user', 'namespace' => 'User', 'as' => 'user.'] , function (){