mirror of
https://github.com/snipe/snipe-it.git
synced 2025-01-24 04:03:34 -08:00
Added accessories images for seeder
This commit is contained in:
parent
79367642b1
commit
a481fa2921
|
@ -21,6 +21,7 @@ $factory->state(App\Models\Accessory::class, 'apple-bt-keyboard', function ($fak
|
|||
|
||||
return [
|
||||
'name' => 'Bluetooth Keyboard',
|
||||
'image' => 'bluetooth.jpg',
|
||||
'category_id' => 8,
|
||||
'manufacturer_id' => 1,
|
||||
'qty' => 10,
|
||||
|
@ -34,6 +35,7 @@ $factory->state(App\Models\Accessory::class, 'apple-usb-keyboard', function ($fa
|
|||
|
||||
return [
|
||||
'name' => 'USB Keyboard',
|
||||
'image' => 'usb-keyboard.jpg',
|
||||
'category_id' => 8,
|
||||
'manufacturer_id' => 1,
|
||||
'qty' => 15,
|
||||
|
@ -47,6 +49,7 @@ $factory->state(App\Models\Accessory::class, 'apple-mouse', function ($faker) {
|
|||
|
||||
return [
|
||||
'name' => 'Magic Mouse',
|
||||
'image' => 'magic-mouse.jpg',
|
||||
'category_id' => 9,
|
||||
'manufacturer_id' => 1,
|
||||
'qty' => 13,
|
||||
|
@ -60,6 +63,7 @@ $factory->state(App\Models\Accessory::class, 'microsoft-mouse', function ($faker
|
|||
|
||||
return [
|
||||
'name' => 'Sculpt Comfort Mouse',
|
||||
'image' => 'comfort-mouse.jpg',
|
||||
'category_id' => 9,
|
||||
'manufacturer_id' => 2,
|
||||
'qty' => 13,
|
||||
|
|
|
@ -13,5 +13,31 @@ class AccessorySeeder extends Seeder
|
|||
factory(Accessory::class, 1)->states('apple-bt-keyboard')->create();
|
||||
factory(Accessory::class, 1)->states('apple-mouse')->create();
|
||||
factory(Accessory::class, 1)->states('microsoft-mouse')->create();
|
||||
|
||||
$src = public_path('/img/demo/accessories/');
|
||||
$dst = 'accessories'.'/';
|
||||
$del_files = Storage::files($dst);
|
||||
|
||||
foreach($del_files as $del_file){ // iterate files
|
||||
$file_to_delete = str_replace($src,'',$del_file);
|
||||
\Log::debug('Deleting: '.$file_to_delete);
|
||||
try {
|
||||
Storage::disk('public')->delete($dst.$del_file);
|
||||
} catch (\Exception $e) {
|
||||
\Log::debug($e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$add_files = glob($src."/*.*");
|
||||
foreach($add_files as $add_file){
|
||||
$file_to_copy = str_replace($src,'',$add_file);
|
||||
\Log::debug('Copying: '.$file_to_copy);
|
||||
try {
|
||||
Storage::disk('public')->put($dst.$file_to_copy, file_get_contents($src.$file_to_copy));
|
||||
} catch (\Exception $e) {
|
||||
\Log::debug($e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
public/img/demo/accessories/bluetooth.jpg
Normal file
BIN
public/img/demo/accessories/bluetooth.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
public/img/demo/accessories/comfort-mouse.jpg
Normal file
BIN
public/img/demo/accessories/comfort-mouse.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 15 KiB |
BIN
public/img/demo/accessories/magic-mouse.jpg
Normal file
BIN
public/img/demo/accessories/magic-mouse.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
public/img/demo/accessories/usb-keyboard.jpg
Normal file
BIN
public/img/demo/accessories/usb-keyboard.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
Loading…
Reference in a new issue