mardi 21 janvier 2020

Laravel Repository

I have a Repository that called Business Logic Repo where my functions or methods stores. And there is a Database Logic Repo that has a method that can interact with the database.

My question is What is the best way to call the functions from Database Logic Repository and use it to the Business Logic Repository.

ex.: on my BusinessLogicRepo I have this function

function listSelection($values){
   return $this->model->getSelection($values);
}

the getSelection() function is from Database Logic Repository wherein it does the query.

function getSelection($tableName, $idField, $nameField){
   $query = DB::table($tableName)->select($idField,$nameField)->get();
   return $query;
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire