Page 1 of 1

Laravel 5

PostPosted: 04 May 2019, 19:20
by merlinofuentesgiron
Hello any can share the integration.php for Laravel 5? Thanks in advance.

Re: Laravel 5

PostPosted: 23 Dec 2019, 19:43
by ollyweston
Well I' m here for the same..

Re: Laravel 5

PostPosted: 18 Aug 2020, 19:19
by TPonsky
I have done it. I put the arrow chat content in a folder in public called chat. Then I edited the database configuration code and installed arrowchat into the same database as my laravel system with the arrowchat_ prefix.

Then I modified the integration.php file in public/chat/includes folder
Code: Select all
// 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;
}
There's a bunch of other functions in there that may need some minor manipulation based on your db structure.

Re: Laravel 5

PostPosted: 18 Aug 2020, 20:20
by Jason
Laravel really depends on a million different things, so the code that I'm providing may or may not work, but we have used this for Laravel before. This might at least get someone started.

In the includes/config.php file, you need to include some files:
Code: Select all
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');
and the includes/integration.php file's get_user_id function:
Code: Select all
	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;
	}