database/seeders/DatabaseSeeder.php
/**
     * Seed the application's database.
     *
     * @return void
     */
Seed the application's database.
@return void
Seed the application ' s database . @return void
public function run()
    {
        User::factory(3)->create();
        User::create([
            'name' => 'ahmadpato',
            'username' => 'ahmadpato',
            'email' => 'ahmadpato93@gmail.com',
            'password' => bcrypt('password')
        ]);
        Category::create([
            'name' => 'Web Programming',
            'slug' => 'web-programming',
        ]);
        Category::create([
            'name' => 'Web Design',
            'slug' => 'web-design',
        ]);
        Category::create([
            'name' => 'Personal',
            'slug' => 'personal',
        ]);
        Post::factory(20)->create();
    }
public function run ( ) { User :: factory ( 3 ) -> create ( ) ; User :: create ( [ 'name' => 'ahmadpato' , 'username' => 'ahmadpato' , 'email' => 'ahmadpato93@gmail.com' , 'password' => bcrypt ( 'password' ) ] ) ; Category :: create ( [ 'name' => 'Web Programming' , 'slug' => 'web-programming' , ] ) ; Category :: create ( [ 'name' => 'Web Design' , 'slug' => 'web-design' , ] ) ; Category :: create ( [ 'name' => 'Personal' , 'slug' => 'personal' , ] ) ; Post :: factory ( 20 ) -> create ( ) ; }
Seed the application's database.
Seed the application ' s database .
// Post::create([ //     'title'     => 'Judul Pertama', //     'slug'      => 'judul-pertama', //     'excerpt'   => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s', //     'body'      => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum', //     'category_id' => 1, //     'user_id'   => 1 // ]); // Post::create([ //     'title'     => 'Judul Kedua', //     'slug'      => 'judul-kedua', //     'excerpt'   => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s', //     'body'      => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum', //     'category_id' => 1, //     'user_id'   => 1 // ]); // Post::create([ //     'title'     => 'Judul Ketiga', //     'slug'      => 'judul-ketiga', //     'excerpt'   => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s', //     'body'      => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum', //     'category_id' => 2, //     'user_id'   => 1 // ]); // Post::create([ //     'title'     => 'Judul Keempat', //     'slug'      => 'judul-keempat', //     'excerpt'   => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s', //     'body'      => 'Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industrys standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum', //     'category_id' => 2, //     'user_id'   => 1 // ]);