Reputation: 945
Using php session in laravel 5 seems impossible to me. But there is no limit to knowledge.
I got a project from somebody in which php session was used in a laravel project. The project is so huge that converting the php sessions to laravel session is a huge task.
But it seems that the php session supports to work on localhost i.e. wamp and the project seems bug free. But deploying on the server its a mess. The server is a linux server. i tried to replicate the setttings to wamp. But can't get it working.
Is there any minor chance of making the application working without going through the whole project.
Upvotes: 0
Views: 961
Reputation: 945
Got a fix to it.
The solution was Since the project was to large to change the whole code so i added a small piece of code in the AppServiceProvider
<?php
namespace App\Providers;
session_start();
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
$this->composer();
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
public function composer(){
view()->share($_SESSION);
}
}
Which defined as a variable in the whole Laravel project as well as session variables to where ever required. Even though this is not the right way to use session but it helps to fix the issue.
Upvotes: 2