snipe-it/database/factories/SettingFactory.php

68 lines
1.8 KiB
PHP
Raw Normal View History

2021-06-10 13:17:44 -07:00
<?php
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| Here you may define all of your model factories. Model factories give
| you a convenient way to create models for testing and seeding your
| database. Just tell the factory how a default model should look.
|
*/
namespace Database\Factories;
use App\Models\AssetModel;
use App\Models\Category;
use App\Models\Company;
use App\Models\Location;
use App\Models\Manufacturer;
use App\Models\Statuslabel;
use App\Models\Supplier;
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 SettingFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = \App\Models\Setting::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
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
'per_page' => 20,
2023-03-16 17:07:46 -07:00
'site_name' => $this->faker->sentence(),
2021-06-10 13:17:44 -07:00
'auto_increment_assets' => false,
'alert_email' => $this->faker->safeEmail(),
'alerts_enabled' => true,
'brand' => 1,
2023-03-16 17:07:46 -07:00
'default_currency' => $this->faker->currencyCode(),
'locale' => 'en',
2021-06-10 13:17:44 -07:00
'pwd_secure_min' => 10, // Match web setup
'email_domain' => 'test.com',
];
}
2023-02-02 17:41:32 -08:00
public function withMultipleFullCompanySupport()
{
return $this->state(function () {
return [
'full_multiple_companies_support' => 1,
];
});
}
2021-06-10 13:17:44 -07:00
}