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?
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
1条答案
按热度按时间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