ollieread / multiauth

Laravel multi auth
441 stars 109 forks source link

Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable. #107

Closed rajanrawal closed 8 years ago

rajanrawal commented 8 years ago

Laravel 5.1.16

php artisan clear compiled

composer updated

composer dump-autoload -o

All tried but getting

App crashing. Throwing error:

BindingResolutionException in Container.php line 744: 
Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable.
ollieread commented 8 years ago

Something is trying to instantiate the Gate interface. I'll check through the code but it may be worth checking your own to see what's going on.

ollieread commented 8 years ago

Assuming that you're using the Laravel 5 branch, I've searched the entire codebase for the term gate, the only time it appears, ever, is in a comment that actually says aggregate.

rajanrawal commented 8 years ago

@ollieread I am really sorry. Yes I am using 5.1.16. I enjoyed you package for 4.2 a lot. But there is nothing out there for laravel >= 5.1.11 + which work nice as yours was!

lucassmacedo commented 8 years ago

I have the same problem... Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable. Using Laravel 5.1

ollieread commented 8 years ago

Can one of you post a stacktrace so that I can exactly what's going on?

jbrooksuk commented 8 years ago

Have you added Gate as an alias to ./config/app.php?

'Gate'      => 'Illuminate\Support\Facades\Gate',

You may also want to run rm -rf bootstrap/cache/* and also composer du.

rajanrawal commented 8 years ago

Yes of course we did it. Though it was not working.

On Wed, Sep 16, 2015 at 1:06 PM, James Brooks notifications@github.com wrote:

Have you added Gate as an alias to ./config/app.php?

'Gate' => 'Illuminate\Support\Facades\Gate',

— Reply to this email directly or view it on GitHub https://github.com/ollieread/multiauth/issues/107#issuecomment-140656327 .

Intensity works... Always...

Thank You & Regards, Rajan Y. Rawal +91 903 315 5300

jbrooksuk commented 8 years ago

What about the last two bits I suggested?

rajanrawal commented 8 years ago

No workout.

Here is the stacktrace

BindingResolutionException in Container.php line 744: Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable. in Container.php line 744 at Container->build('Illuminate\Contracts\Auth\Access\Gate', array()) in Container.php line 626 at Container->make('Illuminate\Contracts\Auth\Access\Gate', array()) in Application.php line 674 at Application->make('Illuminate\Contracts\Auth\Access\Gate') in Container.php line 572 at Container->addDependencyForCallParameter(object(ReflectionParameter), array(), array()) in Container.php line 532 at Container->getMethodDependencies(array(object(AuthServiceProvider), 'boot'), array()) in Container.php line 500 at Container->call(array(object(AuthServiceProvider), 'boot')) in Application.php line 734 at Application->bootProvider(object(AuthServiceProvider)) in Application.php line 717 at Application->Illuminate\Foundation\{closure}(object(AuthServiceProvider), '14') at array_walk(array(object(EventServiceProvider), object(RoutingServiceProvider), object(ControllerServiceProvider), object(CookieServiceProvider), object(DatabaseServiceProvider), object(EncryptionServiceProvider), object(FilesystemServiceProvider), object(FormRequestServiceProvider), object(FoundationServiceProvider), object(PaginationServiceProvider), object(SessionServiceProvider), object(ValidationServiceProvider), object(ViewServiceProvider), object(AppServiceProvider), object(AuthServiceProvider), object(EventServiceProvider), object(RouteServiceProvider), object(MultiauthServiceProvider), object(SluggableServiceProvider)), object(Closure)) in Application.php line 718 at Application->boot() in BootProviders.php line 17 at BootProviders->bootstrap(object(Application)) in Application.php line 203 at Application->bootstrapWith(array('Illuminate\Foundation\Bootstrap\DetectEnvironment', 'Illuminate\Foundation\Bootstrap\LoadConfiguration', 'Illuminate\Foundation\Bootstrap\ConfigureLogging', 'Illuminate\Foundation\Bootstrap\HandleExceptions', 'Illuminate\Foundation\Bootstrap\RegisterFacades', 'Illuminate\Foundation\Bootstrap\RegisterProviders', 'Illuminate\Foundation\Bootstrap\BootProviders')) in Kernel.php line 222 at Kernel->bootstrap() in Kernel.php line 117 at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 87 at Kernel->handle(object(Request)) in index.php line 54

jbrooksuk commented 8 years ago

Have you ran composer update before adding the alias?

rajanrawal commented 8 years ago

Yes all done, basically there is forum question that one asked on laravel forum and the steps you said were mentioned there

https://laracasts.com/discuss/channels/laravel/l51-unable-to-fetch-the-gate-facade-through-composer?page=0

jbrooksuk commented 8 years ago

I already suggested deleting everything in bootstrap/cache ;)

ollieread commented 8 years ago

So this isn't a multiauth issue?

jbrooksuk commented 8 years ago

No, I'm pretty sure that it's not.

ollieread commented 8 years ago

Ahh excellent, I couldn't recreate this anyway!

rajanrawal commented 8 years ago

@jbrooksuk dude what laravel version you are using? Are you on 5.1.16? The latest one?

rajanrawal commented 8 years ago

@ollieread of course even we want to close it if there is not bug, but let test it once. @jbrooksuk I cleaned bootstrap cache as well. Its same here still

jbrooksuk commented 8 years ago

@rajanrawal Yeah, the latest.

rajanrawal commented 8 years ago

I tested everything as it was informed here, its still not working at all and throwing the same error. Anyway thank you.

maximerauch commented 8 years ago

I'm having the same error as @rajanrawal. I'm currently using the version 5.1.17 of Laravel.

php artisan --version
Laravel Framework version 5.1.17 (LTS)

I added sboo/multiauth to composer.json :

"sboo/multiauth" : "4.0.*"

Then I launched composer update command. sboo/multiauth v4.0.9 is installed successfully and everything is going fine, no error at this moment. After that, I ran composer du.

But when I replace ''Illuminate\Auth\AuthServiceProvider' by 'Ollieread\Multiauth\MultiauthServiceProvider' and 'Illuminate\Auth\Passwords\PasswordResetServiceProvider' by 'Ollieread\Multiauth\Passwords\PasswordResetServiceProvider', I'm getting this error :

BindingResolutionException in Container.php line 744:
Target [Illuminate\Contracts\Auth\Access\Gate] is not instantiable.

As I read on differents issues, I cleared cache by deletting boostrap/cache/* folder by still having the error. Am I doing something wrong ?

rajanrawal commented 8 years ago

@Schnapse Some how issue has been closed. Don't know why? I am still stuck with that too. Then i got it worked with https://github.com/Kbwebs/MultiAuth so for now using that. You can try that.

maximerauch commented 8 years ago

@rajanrawal Thanks for your reply, Kbwebs version is working fine.