Created
May 3, 2024 13:11
-
-
Save elmarputz/8d757235758cce0ea4202fe4e654223e to your computer and use it in GitHub Desktop.
users table seeder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Database\Seeders; | |
use Illuminate\Database\Console\Seeds\WithoutModelEvents; | |
use Illuminate\Database\Seeder; | |
class UsersTableSeeder extends Seeder | |
{ | |
/** | |
* Run the database seeds. | |
*/ | |
public function run(): void | |
{ | |
// test user | |
$user = new \App\Models\User; | |
$user->name = 'testuser'; | |
$user->email = 'test@gmail.com'; | |
$user->role = 'admin'; | |
$user->password = bcrypt('secret'); | |
$user->save(); | |
$admin = new \App\Models\User; | |
$admin->name = 'adminuser'; | |
$admin->email = 'admin@gmail.com'; | |
$admin->role = 'admin'; | |
$admin->password = bcrypt('secret'); | |
$admin->save(); | |
$user1 = new \App\Models\User; | |
$user1->name = 'user'; | |
$user1->role = 'user'; | |
$user1->email = 'user@gmail.com'; | |
$user1->password = bcrypt('secret'); | |
$user1->save(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment