lundi 15 février 2016

laravel5 , where to put this generic code

I have some php lines which will be used very often in my application. So I would like to build a function and call it every where in my app. My function could be :

static function array_matiere($id_ecole) {

return $something;
}

I tried to put this code in a controller and then call it like that :

$liste_matieres = MatieresController::array_matieres(Session::get('id_ecole'));

it works, but where to put this kind of function ? in the controller ? in a method file ? what is the best practice ?

Thanks for your responses.

Dominique



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire