Hi, you need to add your repository to the IoC container using a Service Provider.
See the App::bind() function for this feature here: http://laravel.com/docs/ioc#basic-usage
Remember add your Service Provider to the app.php providers list.
For Service Provider see: http://laravel.com/docs/ioc#service-providers
Hope it helps you.
Hey CodeATbusiness,
But isn't the service provider more of an optional step to abstract even further? I mean, shouldnt the repository work "on it's own"?
Maybe I misunderstood something here :)
You're right; the service provider isn't required.
Instead of the psr-0
option in composer.json
, try to adjust the autoload > classmap section like this:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/models",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php", // Don't forget the comma here :)
"app/Yourday"
]
},
This won't give you the psr standard of course, but it should let us know if we're missing something else.
Reached said:
Hey CodeATbusiness,
But isn't the service provider more of an optional step to abstract even further? I mean, shouldnt the repository work "on it's own"?
Maybe I misunderstood something here :)
You're correct, you only need to use a service provider if you're binding an interface to an implementation. Do your filenames and folders match the namespace exactly, including capitalization?
Sorry friends, I was thinking that you need to bind to an implementation as thepsion5 commented us.
Thanks for your reply.
Shouldn't psr-0 be like
"psr-0": {
"Yourday": "app/"
},
And psr-4:
"psr-4": {
"Yourday\\": "app/Yourday"
}
And don't forget to "composer dump-autoload"
Seems like you solved my problem, thanks guys!
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community