repository
repository copied to clipboard
how to use without injection
Hi, can I use doing this
$x = new App\Repositories\MyRepository
without injection at construct??
Yes, initialize your concrete implementation
class X {
private $x = new App\Repositories\UserRepository;
...
}
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 ...
$repo = new \App\Repositories\AppRepository(app(), \Illuminate\Support\Collection::make());