Skip to content

Instantly share code, notes, and snippets.

@bmadigan
Last active August 29, 2015 14:05
Show Gist options
  • Save bmadigan/d9ee520bf38aee1aa6d8 to your computer and use it in GitHub Desktop.
Save bmadigan/d9ee520bf38aee1aa6d8 to your computer and use it in GitHub Desktop.
Receiving Error in Multi-Tenancy Tutorial (To Philip Brown)
Hi.
I was doing the Multi-tenant tutorial and for some reason I keep getting the same error
over and over no matter what I do.
I've redone the code several times and still get the error:
Target [Illuminate\Database\Eloquent\Model] is not instantiable.
Which I understand should have something to do with my ServiceProviders and
binding them via the app.php file.
I have added you as a contributor to a private repo I have created to look at the
code if that's okay.
I re-created your /test route if you wish to see how I'm trying to call the Repository.
Any help would be great, been getting this error for a few days and I'm out of thoughts.
Thanks
@bmadigan
Copy link
Author

In the routes file, I do get the $client and I do get the $context properly, the error is when I try to call the StudentRepository itself.

@philipbrown
Copy link

Hi Brad, where is your service provider? Renaku\Core\Providers\StartServiceProvider doesn't seem to exist?

@bmadigan
Copy link
Author

Sorry about that. I thought I pushed it.

@philipbrown
Copy link

Where are you getting the error?

@bmadigan
Copy link
Author

When I hit the StudentsRepository

@bmadigan
Copy link
Author

I'm completely stumped by it. I've gone through the code for days over and over and I can't figure it out. I was a second pair of eyes that really the codebase might help

@philipbrown
Copy link

Its because you don't have a service provider to inject an instance of the Student model into the repository. Laravel's IoC container is trying to resolve an instance of the abstract Model class.

Set up a service provider to bootstrap your repository and inject an instance of the Student model and it will work.

@bmadigan
Copy link
Author

Beautiful !!! Got it working!! Thanks!! I knew another set of eyes would help

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment