mirror of
https://github.com/koel/koel
synced 2024-11-14 00:17:13 +00:00
32 lines
695 B
PHP
32 lines
695 B
PHP
|
<?php
|
||
|
|
||
|
namespace Database\Factories;
|
||
|
|
||
|
use App\Models\User;
|
||
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
use Illuminate\Support\Facades\Hash;
|
||
|
|
||
|
class UserFactory extends Factory
|
||
|
{
|
||
|
protected $model = User::class;
|
||
|
|
||
|
public function definition(): array
|
||
|
{
|
||
|
return [
|
||
|
'name' => $this->faker->name,
|
||
|
'email' => $this->faker->email,
|
||
|
'password' => Hash::make('secret'),
|
||
|
'is_admin' => false,
|
||
|
'preferences' => [],
|
||
|
'remember_token' => str_random(10),
|
||
|
];
|
||
|
}
|
||
|
|
||
|
public function admin()
|
||
|
{
|
||
|
return $this->state(function (): array {
|
||
|
return ['is_admin' => true];
|
||
|
});
|
||
|
}
|
||
|
}
|