*/ class UserFactory extends Factory { protected $model = User::class; /** * Define the model's default state. * * @return array */ public function definition() { return [ 'email' => $this->faker->safeEmail, 'password' => Hash::make('password'), 'name' => $this->faker->firstName, 'policies' => [], ]; } public function policies(array $policies): self { return $this->state(['policies' => [ 'storeMedia' => true, 'updateMedia' => true, 'destroyMedia' => true, 'listMedia' => true, ...$policies, ]]); } }