bosnadev / repository

Laravel Repositories is a package for Laravel 5 which is used to abstract the database layer. This makes applications much easier to maintain.
https://bosnadev.com
823 stars 233 forks source link

how to use without injection #58

Open carlituxman opened 8 years ago

carlituxman commented 8 years ago

Hi, can I use doing this

$x = new App\Repositories\MyRepository

without injection at construct??

petehouston commented 8 years ago

Yes, initialize your concrete implementation

class X {
   private $x = new App\Repositories\UserRepository;

  ...
}
carlituxman commented 8 years ago

not work for me. Here error: syntax error, unexpected 'new' (T_NEW)

if I use inside a function : Argument 1 passed to Bosnadev\Repositories\Eloquent\Repository::__construct() must be an instance of Illuminate\Container\Container, none given, called in ...

marwanzak commented 8 years ago

$repo = new \App\Repositories\AppRepository(app(), \Illuminate\Support\Collection::make());