am trying to show a simple value stored in session to a view, it is not working correctly
routes.php file
<?php
Route::get('/', 'Test@index');
Route::get('/nnn', 'Test@nnn');
Route::group(['middleware' => ['web']], function () {
});
controller file
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\Http\Requests;
use Session;
class Test extends Controller
{
public function index(){
Session::put('name', 'abcdef');
return view('welcome');
}
public function nnn(){
return view('welcome');
}
}
view file:
<body>
<div class="container">
<div class="content">
<div class="title">Laravel 5</div>
@if(Session::has('name'))
{{ Session::get('name') }}
@endif
</div>
</div>
</body>
when i go to localhost:8000 it is showing session value abcdef
but when i go to localhost:8000/nnn it is not showing any value
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire