snipe-it/database/factories/LicenseSeatFactory.php

27 lines
534 B
PHP
Raw Normal View History

<?php
namespace Database\Factories;
use App\Models\License;
2024-02-13 17:04:53 -08:00
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class LicenseSeatFactory extends Factory
{
public function definition()
{
return [
'license_id' => License::factory(),
];
}
2024-02-13 17:04:53 -08:00
public function assignedToUser(User $user = null)
{
return $this->state(function () use ($user) {
return [
'assigned_to' => $user->id ?? User::factory(),
];
});
}
}