32 lines
760 B
PHP
32 lines
760 B
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Image;
|
|
use App\Models\User;
|
|
use Illuminate\Database\Seeder;
|
|
use Illuminate\Support\Facades\Hash;
|
|
|
|
class DatabaseSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Seed the application's database.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
User::factory(10)->create();
|
|
$creds = [
|
|
'email' => config('admin.email'),
|
|
'name' => config('admin.username'),
|
|
'password' => config('admin.password'),
|
|
];
|
|
$creds["password"] = Hash::make($creds["password"]);
|
|
$user = User::create($creds);
|
|
$user->admin = true;
|
|
$user->save();
|
|
|
|
\App\Models\Product::factory(10)->has(Image::factory()->count(3))->create();
|
|
}
|
|
}
|