You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
xshop/database/seeders/UserSeeder.php

26 lines
594 B
PHTML

2 years ago
<?php
namespace Database\Seeders;
use App\Models\User;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;
class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
\App\Models\User::factory()->count(1)->create(['email' => 'admin@example.com']);
$role = Role::create(['name' => 'super-admin']);
Role::create(['name' => 'manager']);
2 years ago
$superAdmin = User::where('id',1)->first()->assignRole($role);
}
}