PHP Snippet 1:
Session::save();
PHP Snippet 2:
$id = Input::get('id');
Session::forget('cart.' .$id);
Session::save();
PHP Snippet 3:
'cookie' => 'laravel_session',
PHP Snippet 4:
'cookie' => 'myapp_session',
PHP Snippet 5:
Session::put('userData', 'value');
PHP Snippet 6:
$user = Session::get('userData');
if($user->id) echo 'user is logged-in'; //or if($user) - depends on what you store in 'userData' key
else echo 'guest only privilegies';
PHP Snippet 7:
'driver' => env('SESSION_DRIVER', 'file')
PHP Snippet 8:
'driver' => 'file'
PHP Snippet 9:
Route::group(['middleware' => ['web']], function () {
Route::get('/home/login', ['as' => 'login', 'uses' => 'HomeController@getLogin']);
Route::post('/home/login', ['as' => 'login', 'uses' => 'HomeController@postLogin']);
Route::get('/home/dashboard', ['as' => 'home', 'uses' => 'HomeController@getDashboard']);
}
PHP Snippet 10:
'cookie' => env(
'local_cookies',
Str::slug(env('APP_NAME', 'laravel'), '_').'_session'
),
PHP Snippet 11:
public function testLogin(Request $request, $id){
$user = Account::find($id);
Auth::login($user);
}
PHP Snippet 12:
'domain' => null,
PHP Snippet 13:
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
//\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
PHP Snippet 14:
protected $middlewareGroups = [
'web' => [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\Session\Middleware\AuthenticateSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\VerifyCsrfToken::class,
\Illuminate\Routing\Middleware\SubstituteBindings::class,
],
'api' => [
'throttle:60,1',
'bindings',
],
];
PHP Snippet 15:
loginUsingId(1);
PHP Snippet 16:
loginUsingId(1, true);
PHP Snippet 17:
<?php
echo 'hello';
?>
<?php
/**
* Laravel - A PHP Framework For Web Artisans
*
* @package Laravel
* @author Taylor Otwell <[email protected]>
*/
PHP Snippet 18:
'secure' => env('SESSION_SECURE_COOKIE', false)