Come sapete, Laravel 5.2 è stato rilasciato pochi giorni fa. Sto provando questa nuova versione. Ho fatto un nuovo progetto utilizzando il seguente comando sulla CLI:Laravel 5.2 Auth not Working
laravel new testapp
Come da documentation of Authentication Quickstart, ho seguito il seguente comando per percorsi ponteggio e punti di vista di autenticazione:
php artisan make:auth
Ha funzionato bene. La registrazione funziona bene. Ma sto affrontando un problema in Login. Dopo il login Ho provato seguente nel file di route.php:
Route::get('/', function() {
dd(Auth::user());
return view('welcome');
});
Auth::user()
sta tornando null
e anche Auth::check()
e Auth::guest()
non funzionano in modo appropriato. Ho provato la stessa cosa ancora e ancora due volte creando nuovi progetti ma non ottenendo i risultati corretti.
riportano di seguito le completa route.php
<?php
/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function() {
dd(Auth::());
return view('welcome');
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::group(['middleware' => ['web']], function() {
//
});
Route::group(['middleware' => 'web'], function() {
Route::auth();
Route::get('/home', '[email protected]');
});
Qualcuno mi può aiutare? o qualcuno affronta lo stesso problema? Come posso ripararlo?
stai usando il gruppo 'web' middleware nel tuo gruppo percorso? Per favore pubblica tutti i tuoi percorsi.php – Moppo
@Moppo aggiunto sopra nella domanda. –