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?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1XW6EE2
via IFTTT

Aucun commentaire:

Enregistrer un commentaire