1

what is database seeding and why we use in laravel i am new in laravel i do not understand why we are using seeding and what is that and seeding use are in laravel relationship why we are using please explain what is that seeding

    public function run()
    {
        DB::table('users')->insert([
            'name' =>Ste::random(10),
            'email' =>Ste::random(10).'@gmail.com',
            'password' =>crypt('secret'),
        ]);
    }
}

what is seeder and why should use this seeder.

Karan
  • 1,146
  • 1
  • 10
  • 24
prabhat
  • 11
  • 4
  • [Here](https://laravel.com/docs/master/seeding) you go a great documentation. – nakov Jun 11 '19 at 05:58
  • can you provide me another resource to know about this in depth. – prabhat Jun 11 '19 at 06:01
  • Possible duplicate of [What is database seeding in Laravel?](https://stackoverflow.com/questions/41206038/what-is-database-seeding-in-laravel) – nakov Jun 11 '19 at 06:02
  • so many: https://artisansweb.net/database-seeding-laravel/ https://itsolutionstuff.com/post/how-to-create-database-seeder-in-laravel-57example.html – nakov Jun 11 '19 at 06:02

1 Answers1

1

Seeding a database is a process in which an initial set of data is provided to a database when it is being installed . It is especially useful when we want to populate the database with data we want to develop in future. When we are building an application we often need the database to be present before we are finishing the module for inserting data, then we can seed the database. Or in simple words seeding is creating dummy datas.

Seeding is not a must or mandatory, but in some case you will need it.

in your code we are seeding the user data with name of random string, email of randomstring@gmail.com,and password of secret. further reading https://laravel.com/docs/5.8/seeding DO THE RESEARCH DON'T BE LAZY