mirror of
https://github.com/snipe/snipe-it.git
synced 2024-11-13 17:14:10 -08:00
Replace remaining user_ids in factories
This commit is contained in:
parent
3849bb838d
commit
a37d69fcf1
|
@ -40,7 +40,7 @@ class AccessoryFactory extends Factory
|
||||||
$this->faker->randomElement(['Bluetooth', 'Wired']),
|
$this->faker->randomElement(['Bluetooth', 'Wired']),
|
||||||
$this->faker->randomElement(['Keyboard', 'Wired'])
|
$this->faker->randomElement(['Keyboard', 'Wired'])
|
||||||
),
|
),
|
||||||
'user_id' => User::factory()->firstAdmin(),
|
'user_id' => User::factory()->superuser(),
|
||||||
'category_id' => Category::factory(),
|
'category_id' => Category::factory(),
|
||||||
'model_number' => $this->faker->numberBetween(1000000, 50000000),
|
'model_number' => $this->faker->numberBetween(1000000, 50000000),
|
||||||
'location_id' => Location::factory(),
|
'location_id' => Location::factory(),
|
||||||
|
|
|
@ -36,7 +36,7 @@ class ActionlogFactory extends Factory
|
||||||
return [
|
return [
|
||||||
'item_id' => Asset::factory(),
|
'item_id' => Asset::factory(),
|
||||||
'item_type' => Asset::class,
|
'item_type' => Asset::class,
|
||||||
'user_id' => User::factory()->firstAdmin(),
|
'user_id' => User::factory()->superuser(),
|
||||||
'action_type' => 'uploaded',
|
'action_type' => 'uploaded',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,7 @@ class AssetFactory extends Factory
|
||||||
'status_id' => function () {
|
'status_id' => function () {
|
||||||
return Statuslabel::where('name', 'Ready to Deploy')->first() ?? Statuslabel::factory()->rtd()->create(['name' => 'Ready to Deploy']);
|
return Statuslabel::where('name', 'Ready to Deploy')->first() ?? Statuslabel::factory()->rtd()->create(['name' => 'Ready to Deploy']);
|
||||||
},
|
},
|
||||||
'user_id' => User::factory()->firstAdmin(),
|
'user_id' => User::factory()->superuser(),
|
||||||
'asset_tag' => $this->faker->unixTime('now'),
|
'asset_tag' => $this->faker->unixTime('now'),
|
||||||
'notes' => 'Created by DB seeder',
|
'notes' => 'Created by DB seeder',
|
||||||
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
|
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
|
||||||
|
|
|
@ -87,9 +87,7 @@ class AssetModelFactory extends Factory
|
||||||
public function definition()
|
public function definition()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'name' => $this->faker->catchPhrase(),
|
'name' => $this->faker->catchPhrase(),
|
||||||
'category_id' => Category::factory(),
|
'category_id' => Category::factory(),
|
||||||
'model_number' => $this->faker->creditCardNumber(),
|
'model_number' => $this->faker->creditCardNumber(),
|
||||||
|
|
|
@ -38,9 +38,7 @@ class CategoryFactory extends Factory
|
||||||
'eula_text' => $this->faker->paragraph(),
|
'eula_text' => $this->faker->paragraph(),
|
||||||
'require_acceptance' => false,
|
'require_acceptance' => false,
|
||||||
'use_default_eula' => $this->faker->boolean(),
|
'use_default_eula' => $this->faker->boolean(),
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,9 +36,7 @@ class ConsumableFactory extends Factory
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->word(),
|
'name' => $this->faker->word(),
|
||||||
'category_id' => Category::factory(),
|
'category_id' => Category::factory(),
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'item_no' => $this->faker->numberBetween(1000000, 50000000),
|
'item_no' => $this->faker->numberBetween(1000000, 50000000),
|
||||||
'order_number' => $this->faker->numberBetween(1000000, 50000000),
|
'order_number' => $this->faker->numberBetween(1000000, 50000000),
|
||||||
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
|
'purchase_date' => $this->faker->dateTimeBetween('-1 years', 'now', date_default_timezone_get())->format('Y-m-d'),
|
||||||
|
|
|
@ -33,9 +33,7 @@ class DepartmentFactory extends Factory
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->word() . ' Department',
|
'name' => $this->faker->word() . ' Department',
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'location_id' => Location::factory(),
|
'location_id' => Location::factory(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,9 +32,7 @@ class DepreciationFactory extends Factory
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->catchPhrase(),
|
'name' => $this->faker->catchPhrase(),
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'months' => 36,
|
'months' => 36,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,9 +43,7 @@ class LicenseFactory extends Factory
|
||||||
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'name' => $this->faker->name(),
|
'name' => $this->faker->name(),
|
||||||
'license_email' => $this->faker->safeEmail(),
|
'license_email' => $this->faker->safeEmail(),
|
||||||
'serial' => $this->faker->uuid(),
|
'serial' => $this->faker->uuid(),
|
||||||
|
|
|
@ -54,9 +54,7 @@ class ManufacturerFactory extends Factory
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'name' => $this->faker->company(),
|
'name' => $this->faker->company(),
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'support_phone' => $this->faker->phoneNumber(),
|
'support_phone' => $this->faker->phoneNumber(),
|
||||||
'url' => $this->faker->url(),
|
'url' => $this->faker->url(),
|
||||||
'support_email' => $this->faker->safeEmail(),
|
'support_email' => $this->faker->safeEmail(),
|
||||||
|
|
|
@ -40,9 +40,7 @@ class SettingFactory extends Factory
|
||||||
public function definition()
|
public function definition()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'per_page' => 20,
|
'per_page' => 20,
|
||||||
'site_name' => $this->faker->sentence(),
|
'site_name' => $this->faker->sentence(),
|
||||||
'auto_increment_assets' => false,
|
'auto_increment_assets' => false,
|
||||||
|
|
|
@ -26,9 +26,7 @@ class StatuslabelFactory extends Factory
|
||||||
'name' => $this->faker->sentence(),
|
'name' => $this->faker->sentence(),
|
||||||
'created_at' => $this->faker->dateTime(),
|
'created_at' => $this->faker->dateTime(),
|
||||||
'updated_at' => $this->faker->dateTime(),
|
'updated_at' => $this->faker->dateTime(),
|
||||||
'user_id' => function () {
|
'user_id' => User::factory()->superuser(),
|
||||||
return User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin();
|
|
||||||
},
|
|
||||||
'deleted_at' => null,
|
'deleted_at' => null,
|
||||||
'deployable' => 0,
|
'deployable' => 0,
|
||||||
'pending' => 0,
|
'pending' => 0,
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\AssetModel;
|
use App\Models\AssetModel;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
@ -13,35 +14,37 @@ class AssetModelSeeder extends Seeder
|
||||||
{
|
{
|
||||||
AssetModel::truncate();
|
AssetModel::truncate();
|
||||||
|
|
||||||
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
|
|
||||||
// Laptops
|
// Laptops
|
||||||
AssetModel::factory()->count(1)->mbp13Model()->create(); // 1
|
AssetModel::factory()->count(1)->mbp13Model()->create(['user_id' => $admin->id]); // 1
|
||||||
AssetModel::factory()->count(1)->mbpAirModel()->create(); // 2
|
AssetModel::factory()->count(1)->mbpAirModel()->create(['user_id' => $admin->id]); // 2
|
||||||
AssetModel::factory()->count(1)->surfaceModel()->create(); // 3
|
AssetModel::factory()->count(1)->surfaceModel()->create(['user_id' => $admin->id]); // 3
|
||||||
AssetModel::factory()->count(1)->xps13Model()->create(); // 4
|
AssetModel::factory()->count(1)->xps13Model()->create(['user_id' => $admin->id]); // 4
|
||||||
AssetModel::factory()->count(1)->spectreModel()->create(); // 5
|
AssetModel::factory()->count(1)->spectreModel()->create(['user_id' => $admin->id]); // 5
|
||||||
AssetModel::factory()->count(1)->zenbookModel()->create(); // 6
|
AssetModel::factory()->count(1)->zenbookModel()->create(['user_id' => $admin->id]); // 6
|
||||||
AssetModel::factory()->count(1)->yogaModel()->create(); // 7
|
AssetModel::factory()->count(1)->yogaModel()->create(['user_id' => $admin->id]); // 7
|
||||||
|
|
||||||
// Desktops
|
// Desktops
|
||||||
AssetModel::factory()->count(1)->macproModel()->create(); // 8
|
AssetModel::factory()->count(1)->macproModel()->create(['user_id' => $admin->id]); // 8
|
||||||
AssetModel::factory()->count(1)->lenovoI5Model()->create(); // 9
|
AssetModel::factory()->count(1)->lenovoI5Model()->create(['user_id' => $admin->id]); // 9
|
||||||
AssetModel::factory()->count(1)->optiplexModel()->create(); // 10
|
AssetModel::factory()->count(1)->optiplexModel()->create(['user_id' => $admin->id]); // 10
|
||||||
|
|
||||||
// Conference Phones
|
// Conference Phones
|
||||||
AssetModel::factory()->count(1)->polycomModel()->create(); // 11
|
AssetModel::factory()->count(1)->polycomModel()->create(['user_id' => $admin->id]); // 11
|
||||||
AssetModel::factory()->count(1)->polycomcxModel()->create(); // 12
|
AssetModel::factory()->count(1)->polycomcxModel()->create(['user_id' => $admin->id]); // 12
|
||||||
|
|
||||||
// Tablets
|
// Tablets
|
||||||
AssetModel::factory()->count(1)->ipadModel()->create(); // 13
|
AssetModel::factory()->count(1)->ipadModel()->create(['user_id' => $admin->id]); // 13
|
||||||
AssetModel::factory()->count(1)->tab3Model()->create(); // 14
|
AssetModel::factory()->count(1)->tab3Model()->create(['user_id' => $admin->id]); // 14
|
||||||
|
|
||||||
// Phones
|
// Phones
|
||||||
AssetModel::factory()->count(1)->iphone11Model()->create(); // 15
|
AssetModel::factory()->count(1)->iphone11Model()->create(['user_id' => $admin->id]); // 15
|
||||||
AssetModel::factory()->count(1)->iphone12Model()->create(); // 16
|
AssetModel::factory()->count(1)->iphone12Model()->create(['user_id' => $admin->id]); // 16
|
||||||
|
|
||||||
// Displays
|
// Displays
|
||||||
AssetModel::factory()->count(1)->ultrafine()->create(); // 17
|
AssetModel::factory()->count(1)->ultrafine()->create(['user_id' => $admin->id]); // 17
|
||||||
AssetModel::factory()->count(1)->ultrasharp()->create(); // 18
|
AssetModel::factory()->count(1)->ultrasharp()->create(['user_id' => $admin->id]); // 18
|
||||||
|
|
||||||
$src = public_path('/img/demo/models/');
|
$src = public_path('/img/demo/models/');
|
||||||
$dst = 'models'.'/';
|
$dst = 'models'.'/';
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Category;
|
use App\Models\Category;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class CategorySeeder extends Seeder
|
class CategorySeeder extends Seeder
|
||||||
|
@ -11,20 +12,22 @@ class CategorySeeder extends Seeder
|
||||||
{
|
{
|
||||||
Category::truncate();
|
Category::truncate();
|
||||||
|
|
||||||
Category::factory()->count(1)->assetLaptopCategory()->create(); // 1
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
Category::factory()->count(1)->assetDesktopCategory()->create(); // 2
|
|
||||||
Category::factory()->count(1)->assetTabletCategory()->create(); // 3
|
Category::factory()->count(1)->assetLaptopCategory()->create(['user_id' => $admin->id]); // 1
|
||||||
Category::factory()->count(1)->assetMobileCategory()->create(); // 4
|
Category::factory()->count(1)->assetDesktopCategory()->create(['user_id' => $admin->id]); // 2
|
||||||
Category::factory()->count(1)->assetDisplayCategory()->create(); // 5
|
Category::factory()->count(1)->assetTabletCategory()->create(['user_id' => $admin->id]); // 3
|
||||||
Category::factory()->count(1)->assetVoipCategory()->create(); // 6
|
Category::factory()->count(1)->assetMobileCategory()->create(['user_id' => $admin->id]); // 4
|
||||||
Category::factory()->count(1)->assetConferenceCategory()->create(); // 7
|
Category::factory()->count(1)->assetDisplayCategory()->create(['user_id' => $admin->id]); // 5
|
||||||
Category::factory()->count(1)->accessoryKeyboardCategory()->create(); // 8
|
Category::factory()->count(1)->assetVoipCategory()->create(['user_id' => $admin->id]); // 6
|
||||||
Category::factory()->count(1)->accessoryMouseCategory()->create(); // 9
|
Category::factory()->count(1)->assetConferenceCategory()->create(['user_id' => $admin->id]); // 7
|
||||||
Category::factory()->count(1)->consumablePaperCategory()->create(); // 10
|
Category::factory()->count(1)->accessoryKeyboardCategory()->create(['user_id' => $admin->id]); // 8
|
||||||
Category::factory()->count(1)->consumableInkCategory()->create(); // 11
|
Category::factory()->count(1)->accessoryMouseCategory()->create(['user_id' => $admin->id]); // 9
|
||||||
Category::factory()->count(1)->componentHddCategory()->create(); // 12
|
Category::factory()->count(1)->consumablePaperCategory()->create(['user_id' => $admin->id]); // 10
|
||||||
Category::factory()->count(1)->componentRamCategory()->create(); // 13
|
Category::factory()->count(1)->consumableInkCategory()->create(['user_id' => $admin->id]); // 11
|
||||||
Category::factory()->count(1)->licenseGraphicsCategory()->create(); // 14
|
Category::factory()->count(1)->componentHddCategory()->create(['user_id' => $admin->id]); // 12
|
||||||
Category::factory()->count(1)->licenseOfficeCategory()->create(); // 15
|
Category::factory()->count(1)->componentRamCategory()->create(['user_id' => $admin->id]); // 13
|
||||||
|
Category::factory()->count(1)->licenseGraphicsCategory()->create(['user_id' => $admin->id]); // 14
|
||||||
|
Category::factory()->count(1)->licenseOfficeCategory()->create(['user_id' => $admin->id]); // 15
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Consumable;
|
use App\Models\Consumable;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\DB;
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
@ -12,8 +13,11 @@ class ConsumableSeeder extends Seeder
|
||||||
{
|
{
|
||||||
Consumable::truncate();
|
Consumable::truncate();
|
||||||
DB::table('consumables_users')->truncate();
|
DB::table('consumables_users')->truncate();
|
||||||
Consumable::factory()->count(1)->cardstock()->create(); // 1
|
|
||||||
Consumable::factory()->count(1)->paper()->create(); // 2
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
Consumable::factory()->count(1)->ink()->create(); // 3
|
|
||||||
|
Consumable::factory()->count(1)->cardstock()->create(['user_id' => $admin->id]); // 1
|
||||||
|
Consumable::factory()->count(1)->paper()->create(['user_id' => $admin->id]); // 2
|
||||||
|
Consumable::factory()->count(1)->ink()->create(['user_id' => $admin->id]); // 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,7 @@ namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Department;
|
use App\Models\Department;
|
||||||
use App\Models\Location;
|
use App\Models\Location;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DepartmentSeeder extends Seeder
|
class DepartmentSeeder extends Seeder
|
||||||
|
@ -18,11 +19,36 @@ class DepartmentSeeder extends Seeder
|
||||||
|
|
||||||
$locationIds = Location::all()->pluck('id');
|
$locationIds = Location::all()->pluck('id');
|
||||||
|
|
||||||
Department::factory()->count(1)->hr()->create(['location_id' => $locationIds->random()]);
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
Department::factory()->count(1)->engineering()->create(['location_id' => $locationIds->random()]);
|
|
||||||
Department::factory()->count(1)->marketing()->create(['location_id' => $locationIds->random()]);
|
Department::factory()->count(1)->hr()->create([
|
||||||
Department::factory()->count(1)->client()->create(['location_id' => $locationIds->random()]);
|
'location_id' => $locationIds->random(),
|
||||||
Department::factory()->count(1)->product()->create(['location_id' => $locationIds->random()]);
|
'user_id' => $admin->id,
|
||||||
Department::factory()->count(1)->silly()->create(['location_id' => $locationIds->random()]);
|
]);
|
||||||
|
|
||||||
|
Department::factory()->count(1)->engineering()->create([
|
||||||
|
'location_id' => $locationIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::factory()->count(1)->marketing()->create([
|
||||||
|
'location_id' => $locationIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::factory()->count(1)->client()->create([
|
||||||
|
'location_id' => $locationIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::factory()->count(1)->product()->create([
|
||||||
|
'location_id' => $locationIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Department::factory()->count(1)->silly()->create([
|
||||||
|
'location_id' => $locationIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Depreciation;
|
use App\Models\Depreciation;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class DepreciationSeeder extends Seeder
|
class DepreciationSeeder extends Seeder
|
||||||
|
@ -10,8 +11,11 @@ class DepreciationSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Depreciation::truncate();
|
Depreciation::truncate();
|
||||||
Depreciation::factory()->count(1)->computer()->create(); // 1
|
|
||||||
Depreciation::factory()->count(1)->display()->create(); // 2
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
Depreciation::factory()->count(1)->mobilePhones()->create(); // 3
|
|
||||||
|
Depreciation::factory()->count(1)->computer()->create(['user_id' => $admin->id]); // 1
|
||||||
|
Depreciation::factory()->count(1)->display()->create(['user_id' => $admin->id]); // 2
|
||||||
|
Depreciation::factory()->count(1)->mobilePhones()->create(['user_id' => $admin->id]); // 3
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@ use App\Models\Category;
|
||||||
use App\Models\License;
|
use App\Models\License;
|
||||||
use App\Models\LicenseSeat;
|
use App\Models\LicenseSeat;
|
||||||
use App\Models\Supplier;
|
use App\Models\Supplier;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class LicenseSeeder extends Seeder
|
class LicenseSeeder extends Seeder
|
||||||
|
@ -27,21 +28,30 @@ class LicenseSeeder extends Seeder
|
||||||
|
|
||||||
$supplierIds = Supplier::all()->pluck('id');
|
$supplierIds = Supplier::all()->pluck('id');
|
||||||
|
|
||||||
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
|
|
||||||
License::factory()->count(1)->photoshop()->create([
|
License::factory()->count(1)->photoshop()->create([
|
||||||
'category_id' => $categoryIds->random(),
|
'category_id' => $categoryIds->random(),
|
||||||
'supplier_id' => $supplierIds->random(),
|
'supplier_id' => $supplierIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
License::factory()->count(1)->acrobat()->create([
|
License::factory()->count(1)->acrobat()->create([
|
||||||
'category_id' => $categoryIds->random(),
|
'category_id' => $categoryIds->random(),
|
||||||
'supplier_id' => $supplierIds->random(),
|
'supplier_id' => $supplierIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
License::factory()->count(1)->indesign()->create([
|
License::factory()->count(1)->indesign()->create([
|
||||||
'category_id' => $categoryIds->random(),
|
'category_id' => $categoryIds->random(),
|
||||||
'supplier_id' => $supplierIds->random(),
|
'supplier_id' => $supplierIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
License::factory()->count(1)->office()->create([
|
License::factory()->count(1)->office()->create([
|
||||||
'category_id' => $categoryIds->random(),
|
'category_id' => $categoryIds->random(),
|
||||||
'supplier_id' => $supplierIds->random(),
|
'supplier_id' => $supplierIds->random(),
|
||||||
|
'user_id' => $admin->id,
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Manufacturer;
|
use App\Models\Manufacturer;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
use Illuminate\Support\Facades\Storage;
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
@ -12,17 +13,20 @@ class ManufacturerSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Manufacturer::truncate();
|
Manufacturer::truncate();
|
||||||
Manufacturer::factory()->count(1)->apple()->create(); // 1
|
|
||||||
Manufacturer::factory()->count(1)->microsoft()->create(); // 2
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
Manufacturer::factory()->count(1)->dell()->create(); // 3
|
|
||||||
Manufacturer::factory()->count(1)->asus()->create(); // 4
|
Manufacturer::factory()->count(1)->apple()->create(['user_id' => $admin->id]); // 1
|
||||||
Manufacturer::factory()->count(1)->hp()->create(); // 5
|
Manufacturer::factory()->count(1)->microsoft()->create(['user_id' => $admin->id]); // 2
|
||||||
Manufacturer::factory()->count(1)->lenovo()->create(); // 6
|
Manufacturer::factory()->count(1)->dell()->create(['user_id' => $admin->id]); // 3
|
||||||
Manufacturer::factory()->count(1)->lg()->create(); // 7
|
Manufacturer::factory()->count(1)->asus()->create(['user_id' => $admin->id]); // 4
|
||||||
Manufacturer::factory()->count(1)->polycom()->create(); // 8
|
Manufacturer::factory()->count(1)->hp()->create(['user_id' => $admin->id]); // 5
|
||||||
Manufacturer::factory()->count(1)->adobe()->create(); // 9
|
Manufacturer::factory()->count(1)->lenovo()->create(['user_id' => $admin->id]); // 6
|
||||||
Manufacturer::factory()->count(1)->avery()->create(); // 10
|
Manufacturer::factory()->count(1)->lg()->create(['user_id' => $admin->id]); // 7
|
||||||
Manufacturer::factory()->count(1)->crucial()->create(); // 10
|
Manufacturer::factory()->count(1)->polycom()->create(['user_id' => $admin->id]); // 8
|
||||||
|
Manufacturer::factory()->count(1)->adobe()->create(['user_id' => $admin->id]); // 9
|
||||||
|
Manufacturer::factory()->count(1)->avery()->create(['user_id' => $admin->id]); // 10
|
||||||
|
Manufacturer::factory()->count(1)->crucial()->create(['user_id' => $admin->id]); // 10
|
||||||
|
|
||||||
$src = public_path('/img/demo/manufacturers/');
|
$src = public_path('/img/demo/manufacturers/');
|
||||||
$dst = 'manufacturers'.'/';
|
$dst = 'manufacturers'.'/';
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
namespace Database\Seeders;
|
namespace Database\Seeders;
|
||||||
|
|
||||||
use App\Models\Statuslabel;
|
use App\Models\Statuslabel;
|
||||||
|
use App\Models\User;
|
||||||
use Illuminate\Database\Seeder;
|
use Illuminate\Database\Seeder;
|
||||||
|
|
||||||
class StatuslabelSeeder extends Seeder
|
class StatuslabelSeeder extends Seeder
|
||||||
|
@ -10,12 +11,27 @@ class StatuslabelSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Statuslabel::truncate();
|
Statuslabel::truncate();
|
||||||
Statuslabel::factory()->rtd()->create(['name' => 'Ready to Deploy']);
|
|
||||||
Statuslabel::factory()->pending()->create(['name' => 'Pending']);
|
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||||
Statuslabel::factory()->archived()->create(['name' => 'Archived']);
|
|
||||||
Statuslabel::factory()->outForDiagnostics()->create();
|
Statuslabel::factory()->rtd()->create([
|
||||||
Statuslabel::factory()->outForRepair()->create();
|
'name' => 'Ready to Deploy',
|
||||||
Statuslabel::factory()->broken()->create();
|
'user_id' => $admin->id,
|
||||||
Statuslabel::factory()->lost()->create();
|
]);
|
||||||
|
|
||||||
|
Statuslabel::factory()->pending()->create([
|
||||||
|
'name' => 'Pending',
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Statuslabel::factory()->archived()->create([
|
||||||
|
'name' => 'Archived',
|
||||||
|
'user_id' => $admin->id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Statuslabel::factory()->outForDiagnostics()->create(['user_id' => $admin->id]);
|
||||||
|
Statuslabel::factory()->outForRepair()->create(['user_id' => $admin->id]);
|
||||||
|
Statuslabel::factory()->broken()->create(['user_id' => $admin->id]);
|
||||||
|
Statuslabel::factory()->lost()->create(['user_id' => $admin->id]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue