2016-03-25 01:18:05 -07:00
|
|
|
<?php
|
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
use App\Models\Asset;
|
2018-09-29 21:33:52 -07:00
|
|
|
use Illuminate\Support\Facades\Storage;
|
2016-03-25 01:18:05 -07:00
|
|
|
|
|
|
|
class AssetSeeder extends Seeder
|
|
|
|
{
|
|
|
|
public function run()
|
|
|
|
{
|
|
|
|
Asset::truncate();
|
2017-10-28 01:48:50 -07:00
|
|
|
factory(Asset::class, 1000)->states('laptop-mbp')->create();
|
|
|
|
factory(Asset::class, 50)->states('laptop-mbp-pending')->create();
|
|
|
|
factory(Asset::class, 50)->states('laptop-mbp-archived')->create();
|
|
|
|
factory(Asset::class, 50)->states('laptop-air')->create();
|
2017-10-07 03:19:17 -07:00
|
|
|
factory(Asset::class, 5)->states('laptop-surface')->create();
|
|
|
|
factory(Asset::class, 5)->states('laptop-xps')->create();
|
|
|
|
factory(Asset::class, 5)->states('laptop-spectre')->create();
|
|
|
|
factory(Asset::class, 5)->states('laptop-zenbook')->create();
|
|
|
|
factory(Asset::class, 3)->states('laptop-yoga')->create();
|
|
|
|
|
2017-10-28 01:48:50 -07:00
|
|
|
factory(Asset::class, 30)->states('desktop-macpro')->create();
|
|
|
|
factory(Asset::class, 30)->states('desktop-lenovo-i5')->create();
|
|
|
|
factory(Asset::class, 30)->states('desktop-optiplex')->create();
|
2017-10-07 03:19:17 -07:00
|
|
|
|
|
|
|
factory(Asset::class, 5)->states('conf-polycom')->create();
|
|
|
|
factory(Asset::class, 2)->states('conf-polycomcx')->create();
|
|
|
|
|
|
|
|
factory(Asset::class, 12)->states('tablet-ipad')->create();
|
|
|
|
factory(Asset::class, 4)->states('tablet-tab3')->create();
|
|
|
|
|
|
|
|
factory(Asset::class, 27)->states('phone-iphone6s')->create();
|
|
|
|
factory(Asset::class, 40)->states('phone-iphone7')->create();
|
|
|
|
|
2017-10-07 05:31:32 -07:00
|
|
|
factory(Asset::class, 10)->states('ultrafine')->create();
|
|
|
|
factory(Asset::class, 10)->states('ultrasharp')->create();
|
|
|
|
|
2017-10-07 03:19:17 -07:00
|
|
|
|
2020-06-16 16:06:25 -07:00
|
|
|
$del_files = Storage::files('assets');
|
2017-10-28 05:46:43 -07:00
|
|
|
foreach($del_files as $del_file){ // iterate files
|
2018-09-29 21:33:52 -07:00
|
|
|
\Log::debug('Deleting: '.$del_files);
|
|
|
|
try {
|
|
|
|
Storage::disk('public')->delete('assets'.'/'.$del_files);
|
|
|
|
} catch (\Exception $e) {
|
|
|
|
\Log::debug($e);
|
|
|
|
}
|
2017-10-28 05:46:43 -07:00
|
|
|
}
|
|
|
|
|
2018-01-16 07:36:14 -08:00
|
|
|
DB::table('checkout_requests')->truncate();
|
2017-10-28 05:46:43 -07:00
|
|
|
|
2016-03-25 01:18:05 -07:00
|
|
|
}
|
|
|
|
}
|