laravel 8 seeding

Solutions on MaxInterview for laravel 8 seeding by the best coders in the world

showing results for - "laravel 8 seeding"
Emanuele
12 Feb 2018
1<?php
2
3namespace Database\Seeders;
4
5use Illuminate\Database\Seeder;
6use Illuminate\Support\Facades\DB;
7use Illuminate\Support\Facades\Hash;
8use Illuminate\Support\Str;
9
10class DatabaseSeeder extends Seeder
11{
12    /**
13     * Run the database seeders.
14     *
15     * @return void
16     */
17    public function run()
18    {
19        DB::table('users')->insert([
20            'name' => Str::random(10),
21            'email' => Str::random(10).'@gmail.com',
22            'password' => Hash::make('password'),
23        ]);
24    }
25}
Asma
01 Jan 2020
1php artisan db:seed --force
Kira
14 Nov 2020
1/**
2 * Run the database seeders.
3 *
4 * @return void
5 */
6public function run()
7{
8    $this->call([
9        UserSeeder::class,
10        PostSeeder::class,
11        CommentSeeder::class,
12    ]);
13}
Emmanuel
27 Feb 2019
1use App\Models\User;
2
3/**
4 * Run the database seeders.
5 *
6 * @return void
7 */
8public function run()
9{
10    User::factory()
11            ->times(50)
12            ->hasPosts(1)
13            ->create();
14}