dimanche 25 novembre 2018

Laravel 5.7 override default model table

I know I can override a table in a model by doing

protected $table = 'my_custom_table';

But is there a way to enforce custom table naming convention so that I don't have to do this in each model separately?

For example:

public function getTable(){
    return env('DB_PREFIX') . '_' . $module_name . '_' . $entity_name
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire