blessing-skin-server/app/Http/Middleware/EncryptCookies.php
2016-09-24 22:49:20 +08:00

30 lines
628 B
PHP

<?php
namespace App\Http\Middleware;
use Closure;
use Session;
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 = [
'locale'
];
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);
}
}