Laravel 5
PostPosted: 04 May 2019, 19:20
Hello any can share the integration.php for Laravel 5? Thanks in advance.
// this function uses the userid cookie I have getting set by the laravel system.
function get_user_id()
{
$userid = NULL;
if (isset($_COOKIE['userid']))
{
$userid = $_COOKIE['userid'];
}
return $userid;
}
include_once( dirname(dirname(dirname(__FILE__))).'/bootstrap/autoload.php');
include_once( dirname(dirname(dirname(__FILE__))).'/bootstrap/app.php');
include_once( dirname(dirname(dirname(__FILE__))).'/app/Http/Controllers/Auth/app.php');
function get_user_id()
{
$userid = NULL;
if (!empty($_COOKIE['laravel_session']))
{
$app = app();
$kernel = $app->make('Illuminate\Contracts\Http\Kernel');
$response = $kernel->handle(
$request = Illuminate\Http\Request::capture()
);
$id = $app['encrypter']->decrypt($_COOKIE[$app['config']['session.cookie']]);
$app['session']->driver()->setId($id);
$app['session']->driver()->start();
if($app['auth']->user()!= NULL){
$userid = $app['auth']->user()->id;
}
}
return $userid;
}