How to return database table name in Laravel

前端 未结 11 551
执念已碎
执念已碎 2020-12-28 13:28

Is there a way that I can get the current database table in use by the model that I\'m in? I see that there is a table() function in Laravel/Database/Eloquent/model.php but

11条回答
  •  死守一世寂寞
    2020-12-28 13:32

    There is a public getTable() method defined in Eloquent\Model so you should be able to use $model->getTable().

提交回复
热议问题