I recently faced the same issue when trying to integrate CometChat into project of mine. After a bit trial and error, the following code is what I came up with:
// set up autoloader
$base_path = dirname(dirname(dirname(__FILE__)));
include_once($base_path.'\vendor\autoload.php');
$laravel_db_config_file = $base_path . DIRECTORY_SEPARATOR . 'app' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'database.php';
if (!file_exists($laravel_db_config_file))
{
echo "Please make sure you have the Cometchat folder in the public folder of your laravel site";
}
include_once($base_path.'\bootstrap\autoload.php');
$app = include_once($base_path.'\bootstrap\start.php');
$config = include_once($laravel_db_config_file);
$dbl = $config['connections']['mysql'];
I am assuming you have an integration file that holds the get_user_id method as well as any configuration. At the point of login on my app, I added a new session key called userid using Session::set('userid', Auth::user()->id). To access this in ArrowChat, simple use:
Session::get('userid')
Your final code should then look like:
if (Session::get('userid'))
{
$userid = Session::get('userid');
}
return $userid;
Hope this helps a bit...
Emmanuel
thanks for your solution grafikkaos , I am successful to connected to get user_id but I am not unable to chat with others user even with with no friends system (all online) . Any solution ? I just saw the bar only
Hi Andy,
Can you forward me your email address if possible?
Thanks
@grafikkaos one question where did you placed the // set up autoloader code in the cometchat files? in the integration.php?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.