I am quite new in Laravel repository.
I am using l5-repository package.
When I created resource controller, it created as following:
public function __construct(MyRepository $repository, MyValidator $validator)
{
$this->repository = $repository;
$this->validator = $validator;
}
I could get MyRepository
instance with $this->repository
in this controller.
But I need to use another repository in this controller.
I tried to get like this but failed.
$anotherRepo = new AnotherRepo(); // I think AnotherRepo` is interface.
I was going to get $anotherRepo->all()
data but couldn't get $anotherRepo
instance.
Please help me how can I get repository instance.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2MT4YNO
via IFTTT
Aucun commentaire:
Enregistrer un commentaire