database/seeders/UsersSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        $owner = Role::where("name", "owner")
            ->get()
            ->sole();
        $member = Role::where("name", "member")
            ->get()
            ->sole();
        $admin = Role::where("name", "admin")
            ->get()
            ->sole();
        User::create([
            "email" => "owner@gmail.com",
            "name" => "owner",
            "password" => Hash::make("secret@123"),
        ])->attachRole($owner);
        User::create([
            "email" => "member@gmail.com",
            "name" => "member",
            "password" => Hash::make("secret@123"),
        ])->attachRole($member);
        User::create([
            "email" => "admin@gmail.com",
            "name" => "admin",
            "password" => Hash::make("secret123"),
        ])->attachRole($admin);
    }
public function run ( ) { $ owner = Role :: where ( " name " , " owner " ) -> get ( ) -> sole ( ) ; $ member = Role :: where ( " name " , " member " ) -> get ( ) -> sole ( ) ; $ admin = Role :: where ( " name " , " admin " ) -> get ( ) -> sole ( ) ; User :: create ( [ " email " => " owner@gmail.com " , " name " => " owner " , " password " => Hash :: make ( " secret@123 " ) , ] ) -> attachRole ( $ owner ) ; User :: create ( [ " email " => " member@gmail.com " , " name " => " member " , " password " => Hash :: make ( " secret@123 " ) , ] ) -> attachRole ( $ member ) ; User :: create ( [ " email " => " admin@gmail.com " , " name " => " admin " , " password " => Hash :: make ( " secret123 " ) , ] ) -> attachRole ( $ admin ) ; }
Run the database seeds.
Run the database seeds .