Skip to content

Instantly share code, notes, and snippets.

@mewm
Last active December 30, 2015 01:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mewm/7759143 to your computer and use it in GitHub Desktop.
Save mewm/7759143 to your computer and use it in GitHub Desktop.
<?php
#On top of routes (got it in a service provider, but put it here because I have to debug)
App::bind('\Mewm\Shop\Storage\Category\CategoryRepository', function($app) {
return new \Mewm\Shop\Storage\Category\CategoryEloquent();
});
......
#CategoryEloquent looks like this
namespace Mewm\Shop\Storage\Category;
class CategoryEloquent implements CategoryRepository {
protected $category;
public function __construct()
{
$this->category = new \ShopCategory(); //A regular model
}
....
#I get this
Target [Mewm\Shop\Storage\Category\CategoryRepository] is not instantiable.
....
#I try instantiate it from the my controller
class CategoryController extends BaseController {
protected $category;
public function __construct(\Mewm\Shop\Storage\Category\CategoryRepository $category)
{
$this->category = $category;
}
......
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment