database/seeders/AdminSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        DB::table('users')->insert([
            'name' => 'admin',
            'email' => 'admin.application@gmail.com',
            'password' => Hash::make('password#1'),
            'email_verified_at' => now(),
            'created_at' => now(),
            'updated_at' => now(),
            'remember_token' => Str::random(10),
        ]);
        $admin = User::find(1);
        $adminRole = Role::find(1);
        $userRole = Role::find(2);
        $admin->roles()->sync([$adminRole->id,$userRole->id]);
    }
public function run ( ) { DB :: table ( 'users' ) -> insert ( [ 'name' => 'admin' , 'email' => 'admin.application@gmail.com' , 'password' => Hash :: make ( 'password#1' ) , 'email_verified_at' => now ( ) , 'created_at' => now ( ) , 'updated_at' => now ( ) , 'remember_token' => Str :: random ( 10 ) , ] ) ; $ admin = User :: find ( 1 ) ; $ adminRole = Role :: find ( 1 ) ; $ userRole = Role :: find ( 2 ) ; $ admin -> roles ( ) -> sync ( [ $ adminRole -> id , $ userRole -> id ] ) ; }
Run the database seeds.
Run the database seeds .
//$admin->save();