Skip to content
Advertisement

Tag: laravel-seeding

Laravel 9 – Seeder | TypeError array_merge(): Argument #2 must be of type array, int given

I have two tables named Order and OrderItem. While creating data in the Order table, I am trying to enter data into the OrderItem table at the same time. The codes are as follows; OrderSeeder.php OrderFactory.php OrderItemFactory.php Answer When I updated the page like this, the problem was solved. OrderSeeder.php You can use it as a resource when you encounter

Target class [DatabaseSeedersUsersTableSeeder] does not exist

I am getting the error “Target class [DatabaseSeedersUsersTableSeeder] does not exist” and I cannot figure out why. I have already tried solutions posted to similar issues and none of them worked for me. Here is my composer.json autoload/classmap settings UsersTableSeeder class DatabaseSeeder class Answer You are missing namespace in UsersTableSeeder class. This will make autoloader to find the other seeder

laravel seed rollback after seeding database

I have seeded my DB using php artisan db::seed. Is there a way to rollback what I have seeded into my DB? I cannot seem to find any command like php artisan db::seed rollback. Answer use Undo Seeder for Laravel. When you install UndoSeeder, the following artisan commands are made available: more Undo-Seeder

Laravel seeder for table that is hardcoded

I have several tables in my database that are simply used for reference in my application. For example, a table that has two columns, State and State Abbreviation, and has all 50 states and their abbreviations as rows. I want to write seeders for these tables in Laravel, since I want these tables to exist when I start a new

Advertisement