I've run into this problem a few times where I'm creating a CMS and there's one part of the site that will never need more than one record (like contact info or homepage description). Perhaps it also has a hero image or something. This section needs to be editable by the admin.
我曾经遇到过这样的问题,当我创建一个CMS时,站点中有一个部分永远不需要超过一条记录(比如联系信息或主页描述)。也许它也有一个英雄形象什么的。这个部分需要由管理员编辑。
Should I create a contact_infos table just for this one record and create a record manually and restrict the CMS so that you can only edit/update that one record? Just asking to see if there are any cleaner solutions, because a whole table for 1 record seems like a big commitment.
我是否应该为这条记录创建一个contact_infos表,并手动创建一条记录,并限制CMS,以便您只能编辑/更新那条记录?仅仅是询问是否有更干净的解决方案,因为一个记录的整个表看起来是一个很大的承诺。
1 个解决方案
#1
3
It's just a simple model and a single table? Do it. You might need one today, and then later, another, in which case you're already set.
它只是一个简单的模型和一个表?这样做。你可能需要一个今天,然后,另一个,在这种情况下,你已经设置好了。
#1
3
It's just a simple model and a single table? Do it. You might need one today, and then later, another, in which case you're already set.
它只是一个简单的模型和一个表?这样做。你可能需要一个今天,然后,另一个,在这种情况下,你已经设置好了。