snipe-it/database/factories/StatuslabelFactory.php

116 lines
2.5 KiB
PHP
Raw Normal View History

2021-06-10 13:17:44 -07:00
<?php
namespace Database\Factories;
use App\Models\Statuslabel;
2023-03-14 11:34:58 -07:00
use App\Models\User;
2021-06-10 13:19:27 -07:00
use Illuminate\Database\Eloquent\Factories\Factory;
2021-06-10 13:17:44 -07:00
class StatuslabelFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Statuslabel::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
2023-03-16 17:07:46 -07:00
'name' => $this->faker->sentence(),
2021-06-10 13:17:44 -07:00
'created_at' => $this->faker->dateTime(),
'updated_at' => $this->faker->dateTime(),
'user_id' => User::factory()->superuser(),
2021-06-10 13:17:44 -07:00
'deleted_at' => null,
'deployable' => 0,
'pending' => 0,
'archived' => 0,
'notes' => '',
];
}
public function rtd()
{
return $this->state(function () {
return [
2023-03-16 17:07:46 -07:00
'notes' => $this->faker->sentence(),
2021-06-10 13:17:44 -07:00
'deployable' => 1,
'default_label' => 1,
];
});
}
public function readyToDeploy()
{
return $this->rtd();
}
2021-06-10 13:17:44 -07:00
public function pending()
{
return $this->state(function () {
return [
2023-03-16 17:07:46 -07:00
'notes' => $this->faker->sentence(),
2021-06-10 13:17:44 -07:00
'pending' => 1,
'default_label' => 1,
];
});
}
public function archived()
{
return $this->state(function () {
return [
'notes' => 'These assets are permanently undeployable',
'archived' => 1,
'default_label' => 0,
];
});
}
public function outForDiagnostics()
{
return $this->state(function () {
return [
'name' => 'Out for Diagnostics',
'default_label' => 0,
];
});
}
public function outForRepair()
{
return $this->state(function () {
return [
'name' => 'Out for Repair',
'default_label' => 0,
];
});
}
public function broken()
{
return $this->state(function () {
return [
'name' => 'Broken - Not Fixable',
'default_label' => 0,
];
});
}
public function lost()
{
return $this->state(function () {
return [
'name' => 'Lost/Stolen',
'default_label' => 0,
];
});
}
}