snipe-it/database/factories/ManufacturerFactory.php

198 lines
4.5 KiB
PHP
Raw Normal View History

<?php
2021-06-10 13:19:27 -07:00
2021-06-10 13:17:44 -07:00
namespace Database\Factories;
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;
/*
|--------------------------------------------------------------------------
| Asset Model Factories
|--------------------------------------------------------------------------
|
| Factories related exclusively to creating models ..
|
*/
2017-10-07 03:19:07 -07:00
// 1
2017-10-07 03:19:07 -07:00
// 2
2017-10-07 03:19:07 -07:00
// 3
2017-10-07 03:19:07 -07:00
// 4
2017-10-07 03:19:07 -07:00
// 5
2017-10-07 03:19:07 -07:00
// 6
2017-10-07 03:19:07 -07:00
// 7
2017-10-07 03:19:07 -07:00
// 8
2017-10-07 03:19:07 -07:00
// 9
2017-10-07 02:46:04 -07:00
2017-10-07 03:19:07 -07:00
// 10
2017-10-07 02:46:04 -07:00
// 11
2021-06-10 13:17:44 -07:00
class ManufacturerFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \App\Models\Manufacturer::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'name' => $this->faker->company(),
2023-03-14 11:34:58 -07:00
'user_id' => function () {
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
},
2021-06-10 13:17:44 -07:00
'support_phone' => $this->faker->phoneNumber(),
'url' => $this->faker->url(),
'support_email' => $this->faker->safeEmail(),
];
}
public function apple()
{
return $this->state(function () {
return [
'name' => 'Apple',
'url' => 'https://apple.com',
'support_url' => 'https://support.apple.com',
'image' => 'apple.jpg',
];
});
}
public function microsoft()
{
return $this->state(function () {
return [
'name' => 'Microsoft',
'url' => 'https://microsoft.com',
'support_url' => 'https://support.microsoft.com',
'image' => 'microsoft.png',
];
});
}
public function dell()
{
return $this->state(function () {
return [
'name' => 'Dell',
'url' => 'https://dell.com',
'support_url' => 'https://support.dell.com',
'image' => 'dell.png',
];
});
}
public function asus()
{
return $this->state(function () {
return [
'name' => 'Asus',
'url' => 'https://asus.com',
'support_url' => 'https://support.asus.com',
'image' => 'asus.png',
];
});
}
public function hp()
{
return $this->state(function () {
return [
'name' => 'HP',
'url' => 'https://hp.com',
'support_url' => 'https://support.hp.com',
'image' => 'hp.png',
];
});
}
public function lenovo()
{
return $this->state(function () {
return [
'name' => 'Lenovo',
'url' => 'https://lenovo.com',
'support_url' => 'https://support.lenovo.com',
'image' => 'lenovo.jpg',
];
});
}
public function lg()
{
return $this->state(function () {
return [
'name' => 'LG',
'url' => 'https://lg.com',
'support_url' => 'https://support.lg.com',
'image' => 'lg.jpg',
];
});
}
public function polycom()
{
return $this->state(function () {
return [
'name' => 'Polycom',
'url' => 'https://polycom.com',
'support_url' => 'https://support.polycom.com',
'image' => 'polycom.png',
];
});
}
public function adobe()
{
return $this->state(function () {
return [
'name' => 'Adobe',
'url' => 'https://adobe.com',
'support_url' => 'https://support.adobe.com',
'image' => 'adobe.jpg',
];
});
}
public function avery()
{
return $this->state(function () {
return [
'name' => 'Avery',
'url' => 'https://avery.com',
'support_url' => 'https://support.avery.com',
'image' => 'avery.png',
];
});
}
public function crucial()
{
return $this->state(function () {
return [
'name' => 'Crucial',
'url' => 'https://crucial.com',
'support_url' => 'https://support.crucial.com',
'image' => 'crucial.jpg',
];
});
}
}