How to Work Laravel Framework Important Tools like as Facker, Seeder, Model and Factories

0
106

This Capture We learn 3 Things:
Faker
Factories
Advanced Seeders

Create Model First:

After look some of “N” Migrate Table then –

Now create Migrations:

Next Do Migrate Database table:

Put Code into New Migration Table like ….create_team_table

After Migrate Simple create Model:

This will control Team Table as migration file! Do you see that little -m flag? That’s the trigger

Next Make Seeder Into Database Folder Using :

Modify Code into Team Seeder Like Bellow:

Run this with:

Model Factories:
To Insert Team Data into Database Table using above Seeder action.It is very nice when you just need a few records, but what about times when you need to about 100 team? Can you even think of 100 team names?
Very Easy to Insert Data Using Bellow Instruction:
Make a Factory into Database Folder like bellow –

Then use Some Code into There-

Finally- Update TeamSeeder

Open your file called database/seeds/DatabaseSeeder.php

Run this with: