2023-03-23 17:18:33 -07:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
2024-03-20 17:46:09 -07:00
|
|
|
use App\Models\Asset;
|
2023-03-23 17:18:33 -07:00
|
|
|
use App\Models\License;
|
2024-02-13 17:04:53 -08:00
|
|
|
use App\Models\User;
|
2023-03-23 17:18:33 -07:00
|
|
|
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
|
|
|
|
2024-03-20 17:46:09 -07:00
|
|
|
public function assignedToAsset(Asset $asset = null)
|
|
|
|
{
|
|
|
|
return $this->state(function () use ($asset) {
|
|
|
|
return [
|
2024-04-10 16:12:47 -07:00
|
|
|
'asset_id' => $asset->id ?? Asset::factory(),
|
2024-03-20 17:46:09 -07:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
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(),
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
2023-03-23 17:18:33 -07:00
|
|
|
}
|