Answer the question
In order to leave comments, you need to log in
Bind model to repository in Laravel?
in the service provider, I connected the interface with the repository and the model
public function register()
{
$this->app->singleton(UserRepositoryContract::class, function () {
$repository = new UserReporitory(
new User()
);
return new $repository;
});
}
class UserRepository implements UserRepositoryContract
{
private $model;
public function __construct($user)
{
$this->model = $user;
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question