简体   繁体   English

每个laravel模型都需要一张桌子吗

[英]does every laravel model require a table

I'm building a project in laravel 5 and want to create a model that basically converts a day ID (0-6) to a day name (mon-sun). 我正在laravel 5中构建一个项目,并希望创建一个将日期ID(0-6)转换为日期名称(mon-sun)的模型。 It seems overkill to have a whole table set up for this, when the days are never going to change and an array would do just as well. 当日子永远都不会改变,而数组也会做得很好时,为此设置一个完整的表似乎有些过头了。

If I'm setting up this as a class/model, would I still be required by laravel to have an associated table? 如果将其设置为类/模型,laravel是否仍会要求我具有关联的表?

Should I just create a model that doesn't extend the eloquent model? 我应该只创建一个不会扩展雄辩模型的模型吗?

while you create a model , needed to input the respective table name, and the operation which you want to perform can define in constant.php or app.php in 在创建模型时,需要输入相应的表名,并且要执行的操作可以在constant.php或app.php中定义

root_folder/config/app.php  or create file name constant.php in 
root_folder/config/constant.php

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM