1/**
2 * Static method
3 */
4Session::put('key', $value); // Set session variable
5Session::get('key') // Get session variable
6
7/**
8 * Instance method
9 */
10session(['key' => $value]); // Set session variable
11session('key'); // Get session variable
1use Illuminate\Support\Facades\Session;
2
3Session::flash('message','This is a message!');
4
5then in your view::
6
7@if(Session::has('message'))
8
9<p class="alert
10{{ Session::get('alert-class', 'alert-info') }}">{{Session::get('message') }}</p>
11
12@endif
1// Via a request instance...
2$request->session()->put('key', 'value');
3
4// Via the global "session" helper...
5session(['key' => 'value']);
1'for make session: syntax: session(key => value), ex. session('user1'=>'kinjal')
2session can remove using foreget() perticular user; syntax: session().forget(key);
3To delete all users from session: syntax: session()->flush();
4To fetch all session data: syntax: session()->all();