Modules/Staff/Database/Seeds/StaffsDataSeeder.php
/**
     * Run the database seeds.
     *
     * @return void
     */
Run the database seeds.
@return void
Run the database seeds . @return void
public function run()
    {
        Staff::truncate();
        $staffRepo = app(StaffRepository::class);
        $roleRepo = app(RoleRepository::class);
        $staffs = [
            [
                'firstName' => 'Dennis',
                'lastName' => 'O',
                'username' => 'dennisohere',
                'password' => 'secret',
                'email' => 'dennisohere@talkstuff.com',
                'phone' => '08060935051',
                'roleIds' => [$roleRepo->getRoleByName('super_admin')->id],
                'active' => true
            ],
            [
                'firstName' => 'Cassy',
                'lastName' => 'O',
                'username' => 'cassy',
                'password' => 'cassy123',
                'email' => 'cassy@talkstuff.com',
                'phone' => '08060935051',
                'roleIds' => [$roleRepo->getRoleByName('super_admin')->id],
                'active' => true
            ]
        ];
        foreach ($staffs as $staff){
            $staffRepo->saveStaff($staff);
        }
    }
public function run ( ) { Staff :: truncate ( ) ; $ staffRepo = app ( StaffRepository :: class ) ; $ roleRepo = app ( RoleRepository :: class ) ; $ staffs = [ [ 'firstName' => 'Dennis' , 'lastName' => 'O' , 'username' => 'dennisohere' , 'password' => 'secret' , 'email' => 'dennisohere@talkstuff.com' , 'phone' => '08060935051' , 'roleIds' => [ $ roleRepo -> getRoleByName ( 'super_admin' ) -> id ] , 'active' => true ] , [ 'firstName' => 'Cassy' , 'lastName' => 'O' , 'username' => 'cassy' , 'password' => 'cassy123' , 'email' => 'cassy@talkstuff.com' , 'phone' => '08060935051' , 'roleIds' => [ $ roleRepo -> getRoleByName ( 'super_admin' ) -> id ] , 'active' => true ] ] ; foreach ( $ staffs as $ staff ) { $ staffRepo -> saveStaff ( $ staff ) ; } }
Run the database seeds.
Run the database seeds .
/**
         * @var StaffRepository $staffRepo
         */ /**
         * @var RoleRepository $roleRepo
         */