lundi 29 février 2016

Using Laravel 5 Sessions Externally

I've figured out how to boot Laravel in an external script, but I can't seem to get Session::put() to stick.

$path = "/path/to/laravel/bootstrap/";

require $path . 'autoload.php';
$app = require_once $path . 'app.php';

$app->make('Illuminate\Contracts\Http\Kernel')
  ->handle(Illuminate\Http\Request::capture());

print_r(Session::all());
Session::put('test', 1);

Even after I refresh, this is the output:

Array ( 
    [_token] => emt8sZz7U6prnGUnHV889XPKwuhRCuMpVsAOfWW0 
    [flash] => Array ( 
        [old] => Array ( ) 
        [new] => Array ( ) 
    ) 
    [_previous] => Array ( 
        [url] => http://myurl.local  
    )
)

With no trace of my test variable. For some reason it doesn't make it into the Session. Any ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire