blessing-skin-server/app/Http/Middleware/EncryptCookies.php

30 lines
628 B
PHP
Raw Normal View History

2016-08-28 10:05:21 +08:00
<?php
namespace App\Http\Middleware;
use Closure;
use Session;
2016-08-28 10:05:21 +08:00
use Illuminate\Cookie\Middleware\EncryptCookies as BaseEncrypter;
class EncryptCookies extends BaseEncrypter
{
/**
* The names of the cookies that should not be encrypted.
*
* @var array
*/
protected $except = [
2016-09-24 22:49:20 +08:00
'locale'
2016-08-28 10:05:21 +08:00
];
public function handle($request, Closure $next)
{
if (isset($_COOKIE['uid']) && isset($_COOKIE['token'])) {
Session::put('uid' , $_COOKIE['uid']);
Session::put('token', $_COOKIE['token']);
}
return parent::handle($request, $next);
}
2016-08-28 10:05:21 +08:00
}