database/seeds/TenantSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        Schema::disableForeignKeyConstraints();
        DB::table('tenants')->truncate();
        Schema::enableForeignKeyConstraints();
        $user_id = User::first()->id;
        DB::table('tenants')->insert([
            [
                'user_id' => $user_id,
                'name' => 'Tenant 1',
                'phone' => '0123456789',
                'image' => '',
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now(),
            ],
            [
                'user_id' => $user_id,
                'name' => 'Tenant 2',
                'phone' => '0123456789',
                'image' => '',
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now(),
            ],
            [
                'user_id' => $user_id,
                'name' => 'Tenant 3',
                'phone' => '0123456789',
                'image' => '',
                'created_at' => Carbon::now(),
                'updated_at' => Carbon::now(),
            ],
        ]);
    }
public function run ( ) { Schema :: disableForeignKeyConstraints ( ) ; DB :: table ( 'tenants' ) -> truncate ( ) ; Schema :: enableForeignKeyConstraints ( ) ; $ user_id = User :: first ( ) -> id ; DB :: table ( 'tenants' ) -> insert ( [ [ 'user_id' => $ user_id , 'name' => 'Tenant 1' , 'phone' => '0123456789' , 'image' => '' , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] , [ 'user_id' => $ user_id , 'name' => 'Tenant 2' , 'phone' => '0123456789' , 'image' => '' , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] , [ 'user_id' => $ user_id , 'name' => 'Tenant 3' , 'phone' => '0123456789' , 'image' => '' , 'created_at' => Carbon :: now ( ) , 'updated_at' => Carbon :: now ( ) , ] , ] ) ; }
Run the database seeds.
Run the database seeds .