vendredi 27 octobre 2017

Laravel: event before fetching query

I'm creating an API system and I want to create a model that is able automatically to use different tables.

What I'm trying to archive is to use a query for example like this:

CarParts::where("car_brand", "toyota")->get();

then the model will use the table

car_parts_toyota

So far, with the events, I'm able to save this info in the proper table but not to fetch it.

I've created a simple event that will be trigged on "saving" calling the setTable() method but I can't find events that will be trigged on "fetching".

Is it possible?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire