How can I get the model, or pass the model, from a child class to a parent?
I need the model so I can get the table name associated to that model (as shown here).
I make the request from my child controller:
class UserQuestions extends ResourceController
{
public function getUserQuestions(Request $request)
{
$input = $request->all();
return $this->getFilterables($input);
In my parent Resource Controller:
protected function getFilterables($input)
{
DB::table(Model::getTable())->whereIn($filter_field, $filters_array)->get()
The response is a 500 error. I'm tail
ing the Laravel logs, but am getting no error there.
I've also tried passing it through:
return $this->getFilterables(UserQuestion, $input);
This also does not work.
How can I get the model?
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire