Im using laravel 5.4 and im trying to figure out for a new application how to set it up well. So i digged into repositories which didnt gave a real answer. I found http://ift.tt/1ZsSj2g and this sounds pretty clear to me.
A old co worker told me another way of using repositories but im taking his answer not really well... He showed me this:
class ExampleRepository
{
public function __construct()
{
$this->models();
}
private function models()
{
$this->user = app( User::class );
}
public function findUser( $userId )
{
return $this->user->find( $userId );
}
}
My real question: which example should i use according to standards and flexibility?
Aucun commentaire:
Enregistrer un commentaire