mardi 6 novembre 2018

Laravel - Set table dynamically on model for Auth::guard()

I am working on a project which became quite crucial that i have one model (codes) but two tables which i when i needed to store a record or retrieve records in any of the tables i used setTable('table1') or setTable('table2') on the table instance. This is working as expected.

I now want to do authentication using this model but since the model doesnt have a default table, i am not able to. and the error i get states that the 'codes' table doesnt exist obviously. Is there a way to set the table to be used (which depends on the type of user ) before doing Auth::guard('codes')->attempt($credentials) ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire