medialibrary-helper/tests/workbench/database/factories/Models/UserFactory.php

42 lines
910 B
PHP
Raw Normal View History

2024-01-03 13:07:03 +01:00
<?php
namespace Database\Factories\Models;
use Workbench\App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Facades\Hash;
/**
* @extends Factory<User>
*/
class UserFactory extends Factory
{
protected $model = User::class;
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition()
{
return [
'email' => $this->faker->safeEmail,
'password' => Hash::make('password'),
'name' => $this->faker->firstName,
2024-01-03 13:42:29 +01:00
'policies' => [],
2024-01-03 13:07:03 +01:00
];
}
2024-01-03 13:42:29 +01:00
public function policies(array $policies): self
{
return $this->state(['policies' => [
'storeMedia' => true,
'updateMedia' => true,
'destroyMedia' => true,
'listMedia' => true,
...$policies,
]]);
}
2024-01-03 13:07:03 +01:00
}