mercredi 14 mars 2018

inject model in laravel controllers constructor

I want to know if this is a good practice to use my model class in controllers in this way :

public function __construct(Rule $rules)
{
    $this->rules = $rules;
}

I do not want to repeat myself in my controllers so I want to know what is the best approach for that

Aucun commentaire:

Enregistrer un commentaire