ok
This commit is contained in:
42
Production/SNIPE-IT/database/seeders/ActionlogSeeder.php
Normal file
42
Production/SNIPE-IT/database/seeders/ActionlogSeeder.php
Normal file
@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Actionlog;
|
||||
use App\Models\Asset;
|
||||
use App\Models\Location;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ActionlogSeeder extends Seeder
|
||||
{
|
||||
public function run()
|
||||
{
|
||||
Actionlog::truncate();
|
||||
|
||||
if (! Asset::count()) {
|
||||
$this->call(AssetSeeder::class);
|
||||
}
|
||||
|
||||
if (! Location::count()) {
|
||||
$this->call(LocationSeeder::class);
|
||||
}
|
||||
|
||||
$admin = User::where('permissions->superuser', '1')->first() ?? User::factory()->firstAdmin()->create();
|
||||
|
||||
Actionlog::factory()
|
||||
->count(300)
|
||||
->assetCheckoutToUser()
|
||||
->create(['user_id' => $admin->id]);
|
||||
|
||||
Actionlog::factory()
|
||||
->count(100)
|
||||
->assetCheckoutToLocation()
|
||||
->create(['user_id' => $admin->id]);
|
||||
|
||||
Actionlog::factory()
|
||||
->count(20)
|
||||
->licenseCheckoutToUser()
|
||||
->create(['user_id' => $admin->id]);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user