lock-laravel
lock-laravel copied to clipboard
Target [BeatSwitch\Lock\Drivers\Driver] is not instantiable.
First: I have seen Issue #3 but I'm using Laravel 5 and the latest version of laravel-lock, 0.2.1.
When trying dependency injection on the Controller (like suggested in the documentation)
public function __construct(\BeatSwitch\Lock\Manager $manager) {
$this->lockManager = $manager;
}
this happens:
BindingResolutionException in Container.php line 785:
Target [BeatSwitch\Lock\Drivers\Driver] is not instantiable.
Any hints or suggestions?
@driesvints I am also having this issue with a fresh L5 and Lock installation...
I'm just gonna be honest with you guys. I don't have the time atm to look into this and probably won't have for the upcoming weeks. If anyone can take the time to figure this out, that'd be great :confused:
@driesvints I'm not sure if this is the issue that @lbausch is having but I found that my issue was that I was resetting the Auth::user in my OAuth middleware.
The way that I got around this was to attach the Lock instance to the Auth user in a middleware after OAuth had set my proper user.
IMO since the Auth::user could be seen as part of the request it would be a good place to set the manager caller and such.
It's ugly, but this is our middleware right now:
public function handle($request, Closure $next)
{
$this->filter();
$userId = $this->authorizer->getChecker()->getAccessToken()->getSession()->getOwnerId();
try {
Auth::onceUsingId($userId);
$user = Auth::user();
$manager = app('lock.manager');
$lock = $manager->caller($user);
Auth::user()->setLock($lock);
} catch (Exception $e) {
return Response::json(['error' => 'Unauthorized access'], 401);
}
return $next($request);
}
Im taking a look at this issue, I am having the same problem.
Can anyone test if this problem still happens in the latest release?