2021-06-10 13:17:44 -07:00
|
|
|
<?php
|
2021-06-10 13:19:27 -07:00
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
namespace Database\Factories;
|
2021-06-10 13:19:27 -07:00
|
|
|
|
2023-03-20 11:39:27 -07:00
|
|
|
use App\Models\CustomField;
|
2021-06-10 13:17:44 -07:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
class CustomFieldFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
2023-03-20 11:39:27 -07:00
|
|
|
protected $model = CustomField::class;
|
2021-06-10 13:17:44 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function definition()
|
|
|
|
{
|
|
|
|
return [
|
2023-09-19 17:02:18 -07:00
|
|
|
'name' => $this->faker->unique()->catchPhrase(),
|
2021-06-10 13:17:44 -07:00
|
|
|
'format' => '',
|
|
|
|
'element' => 'text',
|
2023-04-25 20:57:03 -07:00
|
|
|
'auto_add_to_fieldsets' => '0',
|
2023-10-25 18:35:33 -07:00
|
|
|
'show_in_requestable_list' => '0',
|
2021-06-10 13:17:44 -07:00
|
|
|
];
|
|
|
|
}
|
|
|
|
|
|
|
|
public function imei()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'IMEI',
|
|
|
|
'help_text' => 'The IMEI number for this device.',
|
|
|
|
'format' => 'regex:/^[0-9]{15}$/',
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function phone()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'Phone Number',
|
|
|
|
'help_text' => 'Enter the phone number for this device.',
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function ram()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'RAM',
|
|
|
|
'help_text' => 'The amount of RAM this device has.',
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function cpu()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'CPU',
|
|
|
|
'help_text' => 'The speed of the processor on this device.',
|
2023-10-25 18:35:33 -07:00
|
|
|
'show_in_requestable_list' => '1',
|
2021-06-10 13:17:44 -07:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function macAddress()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'MAC Address',
|
|
|
|
'format' => 'regex:/^([0-9a-fA-F]{2}[:-]){5}[0-9a-fA-F]{2}$/',
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
2023-10-25 21:04:30 -07:00
|
|
|
|
|
|
|
public function testEncrypted()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'Test Encrypted',
|
2023-10-25 22:25:51 -07:00
|
|
|
'field_encrypted' => '1',
|
2023-10-25 23:41:25 -07:00
|
|
|
'help_text' => 'This is a sample encrypted field.',
|
2023-10-25 21:04:30 -07:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
public function testCheckbox()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
|
|
|
'name' => 'Test Checkbox',
|
2023-10-25 23:41:25 -07:00
|
|
|
'help_text' => 'This is a sample checkbox.',
|
2023-10-25 21:04:30 -07:00
|
|
|
'field_values' => "One\nTwo\nThree",
|
|
|
|
'element' => 'checkbox',
|
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
2023-10-25 23:41:25 -07:00
|
|
|
|
2021-06-10 13:17:44 -07:00
|
|
|
}
|