Posted on

x-file seeds

Within the DatabaseSeeder class, you may use the call method to execute additional seed classes. Using the call method allows you to break up your database seeding into multiple files so that no single seeder class becomes too large. The call method accepts an array of seeder classes that should be executed:

Of course, manually specifying the attributes for each model seed is cumbersome. Instead, you can use model factories to conveniently generate large amounts of database records. First, review the model factory documentation to learn how to define your factories.

You may type-hint any dependencies you need within the run method’s signature. They will automatically be resolved via the Laravel service container.

Calling Additional Seeders

As an example, let’s modify the default DatabaseSeeder class and add a database insert statement to the run method:

You may execute the db:seed Artisan command to seed your database. By default, the db:seed command runs the DatabaseSeedersDatabaseSeeder class, which may in turn invoke other seed classes. However, you may use the –class option to specify a specific seeder class to run individually:

Laravel includes the ability to seed your database with data using seed classes. All seed classes are stored in the database/seeders directory. By default, a DatabaseSeeder class is defined for you. From this class, you may use the call method to run other seed classes, allowing you to control the seeding order.

Using Model Factories

To generate a seeder, execute the make:seeder Artisan command. All seeders generated by the framework will be placed in the database/seeders directory:

For example, let’s create 50 users that each has one related post:

X-file seeds

Bryant: And that's a production shot from the company. We didn't have to head into the desert.

Johnsen: It helps us to create the cuts, the mood, the timing. Everything.

Johnsen: We changed the line you see at the end two or three times. It wasn't always "The Truth Is Out There".

The ghost

Bryant: It makes you feel a bit edgy. Just a sense of terror.

Johnsen: Another cameo from Bruce, this time as a ghost. We filmed it in one of the hallways in our office.

Bryant: He never told us exactly why he wanted it. But it certainly looks intriguing, especially because it's a mirrored image.

The chart

Johnsen: It definitely got a lot of attention. The only other involvement we had with the show was that we had done some documentary work about cattle mutilation and UFOs prior to making this opening sequence, and The X-Files used some Polaroids we'd obtained from a sheriff in Colorado.

Bryant: We can gen something up if you give us a minute. But there's really no hidden meaning behind that, or the fact part of the hand is red. It was just to give it a little extra layer. Though we wouldn't want to debunk any theories fans may have!