Limit migration to one row in Laravel

ffvjumwh  于 2022-10-22  发布在  PHP
关注(0)|答案(1)|浏览(153)

On a part of a website I am making, I want to have a table for the website's information (About Us Page). To do this, I need to have a table that can only have one row. How can I limit the Laravel migration for this?

9o685dep

9o685dep1#

As far as I understand you want to have a database table with only and exactly one row, and you want to make that limitation with a Laravel Migration? As far as I'm aware there is no such limitation in Laravel, but if you are just trying to populate the table with one row you could set up a seeder:
php artisan make:seeder UserSeeder
and then run the seeder with the following command:
php artisan db:seed
You can find all the information in the docs here: https://laravel.com/docs/9.x/seeding

相关问题