Seed with demo images
|
@ -159,6 +159,14 @@ class AssetModelsController extends Controller
|
||||||
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.assoc_users')));
|
return response()->json(Helper::formatStandardApiResponse('error', null, trans('admin/models/message.assoc_users')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($assetmodel->image) {
|
||||||
|
try {
|
||||||
|
unlink(public_path().'/uploads/models/'.$assetmodel->image);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$assetmodel->delete();
|
$assetmodel->delete();
|
||||||
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/assetmodels/message.delete.success')));
|
return response()->json(Helper::formatStandardApiResponse('success', null, trans('admin/assetmodels/message.delete.success')));
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ class AssetModelsController extends Controller
|
||||||
if (Input::file('image')) {
|
if (Input::file('image')) {
|
||||||
|
|
||||||
$image = Input::file('image');
|
$image = Input::file('image');
|
||||||
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
|
$file_name = slug($image->getClientOriginalName()) . "." . $image->getClientOriginalExtension();
|
||||||
$path = public_path('uploads/models/');
|
$path = public_path('uploads/models/');
|
||||||
|
|
||||||
if ($image->getClientOriginalExtension()!='svg') {
|
if ($image->getClientOriginalExtension()!='svg') {
|
||||||
|
@ -213,9 +213,17 @@ class AssetModelsController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input::file('image')) {
|
if (Input::file('image')) {
|
||||||
|
|
||||||
$image = Input::file('image');
|
$image = Input::file('image');
|
||||||
$file_name = str_random(25) . "." . $image->getClientOriginalExtension();
|
$file_name = str_slug($image->getClientOriginalName()) . "." . $image->getClientOriginalExtension();
|
||||||
$path = public_path('uploads/models/');
|
$path = public_path('uploads/models/');
|
||||||
|
$old_image = $path.$model->image;
|
||||||
|
|
||||||
|
try {
|
||||||
|
unlink($old_image);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error($e);
|
||||||
|
}
|
||||||
|
|
||||||
if ($image->getClientOriginalExtension()!='svg') {
|
if ($image->getClientOriginalExtension()!='svg') {
|
||||||
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
|
Image::make($image->getRealPath())->resize(500, null, function ($constraint) {
|
||||||
|
@ -259,6 +267,15 @@ class AssetModelsController extends Controller
|
||||||
// Throw an error that this model is associated with assets
|
// Throw an error that this model is associated with assets
|
||||||
return redirect()->route('models.index')->with('error', trans('admin/models/message.assoc_users'));
|
return redirect()->route('models.index')->with('error', trans('admin/models/message.assoc_users'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($model->image) {
|
||||||
|
try {
|
||||||
|
unlink(public_path().'/uploads/models/'.$model->image);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Delete the model
|
// Delete the model
|
||||||
$model->delete();
|
$model->delete();
|
||||||
|
|
||||||
|
|
|
@ -76,7 +76,7 @@ class ManufacturersController extends Controller
|
||||||
|
|
||||||
if ($request->file('image')) {
|
if ($request->file('image')) {
|
||||||
$image = $request->file('image');
|
$image = $request->file('image');
|
||||||
$file_name = str_random(25).".".$image->getClientOriginalExtension();
|
$file_name = str_slug($image->getClientOriginalName()).".".$image->getClientOriginalExtension();
|
||||||
$path = public_path('uploads/manufacturers/'.$file_name);
|
$path = public_path('uploads/manufacturers/'.$file_name);
|
||||||
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
|
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
|
@ -140,8 +140,17 @@ class ManufacturersController extends Controller
|
||||||
|
|
||||||
if ($request->file('image')) {
|
if ($request->file('image')) {
|
||||||
$image = $request->file('image');
|
$image = $request->file('image');
|
||||||
$file_name = str_random(25).".".$image->getClientOriginalExtension();
|
$file_name = str_slug($image->getClientOriginalName()).".".$image->getClientOriginalExtension();
|
||||||
$path = public_path('uploads/manufacturers/'.$file_name);
|
$path = public_path('uploads/manufacturers/'.$file_name);
|
||||||
|
$old_image = $path.$model->image;
|
||||||
|
|
||||||
|
try {
|
||||||
|
unlink($old_image);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error($e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
|
Image::make($image->getRealPath())->resize(200, null, function ($constraint) {
|
||||||
$constraint->aspectRatio();
|
$constraint->aspectRatio();
|
||||||
$constraint->upsize();
|
$constraint->upsize();
|
||||||
|
@ -178,6 +187,16 @@ class ManufacturersController extends Controller
|
||||||
// Redirect to the asset management page
|
// Redirect to the asset management page
|
||||||
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.assoc_users'));
|
return redirect()->route('manufacturers.index')->with('error', trans('admin/manufacturers/message.assoc_users'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($manufacturer->image) {
|
||||||
|
try {
|
||||||
|
unlink(public_path().'/uploads/manufacturers/'.$manufacturer->image);
|
||||||
|
} catch (\Exception $e) {
|
||||||
|
\Log::error($e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Delete the manufacturer
|
// Delete the manufacturer
|
||||||
$manufacturer->delete();
|
$manufacturer->delete();
|
||||||
// Redirect to the manufacturers management page
|
// Redirect to the manufacturers management page
|
||||||
|
|
|
@ -34,7 +34,8 @@ $factory->defineAs(Actionlog::class, 'asset-checkout-user', function (Faker\Gene
|
||||||
->update(
|
->update(
|
||||||
[
|
[
|
||||||
'assigned_to' => $target->id,
|
'assigned_to' => $target->id,
|
||||||
'assigned_type' => App\Models\User::class
|
'assigned_type' => App\Models\User::class,
|
||||||
|
'assigned_to' => $target->location_id,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -59,7 +60,8 @@ $factory->defineAs(Actionlog::class, 'asset-checkout-location', function (Faker\
|
||||||
->update(
|
->update(
|
||||||
[
|
[
|
||||||
'assigned_to' => $target->id,
|
'assigned_to' => $target->id,
|
||||||
'assigned_type' => App\Models\Location::class
|
'assigned_type' => App\Models\Location::class,
|
||||||
|
'assigned_to' => $target->id,
|
||||||
]
|
]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ use App\Models\Category;
|
||||||
$factory->define(Asset::class, function (Faker\Generator $faker) {
|
$factory->define(Asset::class, function (Faker\Generator $faker) {
|
||||||
return [
|
return [
|
||||||
'name' => null,
|
'name' => null,
|
||||||
'rtd_location_id' => rand(1,30),
|
'rtd_location_id' => rand(1,10),
|
||||||
'serial' => $faker->uuid,
|
'serial' => $faker->uuid,
|
||||||
'status_id' => 1,
|
'status_id' => 1,
|
||||||
'user_id' => 1,
|
'user_id' => 1,
|
||||||
|
|
|
@ -32,6 +32,7 @@ $factory->state(App\Models\AssetModel::class, 'mbp-13-model', function ($faker)
|
||||||
'manufacturer_id' => 1,
|
'manufacturer_id' => 1,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'mbp.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -43,6 +44,7 @@ $factory->state(App\Models\AssetModel::class, 'mbp-air-model', function ($faker)
|
||||||
'manufacturer_id' => 1,
|
'manufacturer_id' => 1,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'macbookair.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -54,6 +56,7 @@ $factory->state(App\Models\AssetModel::class, 'surface-model', function ($faker)
|
||||||
'manufacturer_id' => 2,
|
'manufacturer_id' => 2,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'surface.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -65,6 +68,7 @@ $factory->state(App\Models\AssetModel::class, 'xps13-model', function ($faker) {
|
||||||
'manufacturer_id' => 3,
|
'manufacturer_id' => 3,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'xps.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -76,6 +80,7 @@ $factory->state(App\Models\AssetModel::class, 'zenbook-model', function ($faker)
|
||||||
'manufacturer_id' => 4,
|
'manufacturer_id' => 4,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'zenbook.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -87,6 +92,7 @@ $factory->state(App\Models\AssetModel::class, 'spectre-model', function ($faker)
|
||||||
'manufacturer_id' => 5,
|
'manufacturer_id' => 5,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'spectre.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -98,6 +104,7 @@ $factory->state(App\Models\AssetModel::class, 'yoga-model', function ($faker) {
|
||||||
'manufacturer_id' => 6,
|
'manufacturer_id' => 6,
|
||||||
'eol' => '36',
|
'eol' => '36',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'yoga.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,6 +122,7 @@ $factory->state(App\Models\AssetModel::class, 'macpro-model', function ($faker)
|
||||||
'manufacturer_id' => 1,
|
'manufacturer_id' => 1,
|
||||||
'eol' => '24',
|
'eol' => '24',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'imacpro.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -125,6 +133,7 @@ $factory->state(App\Models\AssetModel::class, 'lenovo-i5-model', function ($fake
|
||||||
'manufacturer_id' => 6,
|
'manufacturer_id' => 6,
|
||||||
'eol' => '24',
|
'eol' => '24',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'lenovoi5.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -136,6 +145,7 @@ $factory->state(App\Models\AssetModel::class, 'optiplex-model', function ($faker
|
||||||
'model_number' => '5040 (MRR81)',
|
'model_number' => '5040 (MRR81)',
|
||||||
'eol' => '24',
|
'eol' => '24',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'optiplex.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -154,6 +164,7 @@ $factory->state(App\Models\AssetModel::class, 'polycom-model', function ($faker)
|
||||||
'manufacturer_id' => 8,
|
'manufacturer_id' => 8,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'soundstation.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -164,6 +175,7 @@ $factory->state(App\Models\AssetModel::class, 'polycomcx-model', function ($fake
|
||||||
'manufacturer_id' => 8,
|
'manufacturer_id' => 8,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'cx3000.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -181,6 +193,7 @@ $factory->state(App\Models\AssetModel::class, 'ipad-model', function ($faker) {
|
||||||
'manufacturer_id' => 1,
|
'manufacturer_id' => 1,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'ipad.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -192,6 +205,7 @@ $factory->state(App\Models\AssetModel::class, 'tab3-model', function ($faker) {
|
||||||
'manufacturer_id' => 6,
|
'manufacturer_id' => 6,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'tab3.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -209,6 +223,7 @@ $factory->state(App\Models\AssetModel::class, 'iphone6s-model', function ($faker
|
||||||
'manufacturer_id' => 1,
|
'manufacturer_id' => 1,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 3,
|
'depreciation_id' => 3,
|
||||||
|
'image' => 'iphone6.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -219,6 +234,7 @@ $factory->state(App\Models\AssetModel::class, 'iphone7-model', function ($faker)
|
||||||
'manufacturer_id' => 1,
|
'manufacturer_id' => 1,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 1,
|
'depreciation_id' => 1,
|
||||||
|
'image' => 'iphone7.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -235,6 +251,7 @@ $factory->state(App\Models\AssetModel::class, 'ultrafine', function ($faker) {
|
||||||
'manufacturer_id' => 7,
|
'manufacturer_id' => 7,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 2,
|
'depreciation_id' => 2,
|
||||||
|
'image' => 'ultrafine.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -245,6 +262,7 @@ $factory->state(App\Models\AssetModel::class, 'ultrasharp', function ($faker) {
|
||||||
'manufacturer_id' => 3,
|
'manufacturer_id' => 3,
|
||||||
'eol' => '12',
|
'eol' => '12',
|
||||||
'depreciation_id' => 2,
|
'depreciation_id' => 2,
|
||||||
|
'image' => 'ultrasharp.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,8 @@ $factory->state(App\Models\Manufacturer::class, 'apple', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Apple',
|
'name' => 'Apple',
|
||||||
'url' => 'https://apple.com',
|
'url' => 'https://apple.com',
|
||||||
'support_url' => 'https://support.apple.com'
|
'support_url' => 'https://support.apple.com',
|
||||||
|
'image' => 'apple.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -33,7 +34,8 @@ $factory->state(App\Models\Manufacturer::class, 'microsoft', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Microsoft',
|
'name' => 'Microsoft',
|
||||||
'url' => 'https://microsoft.com',
|
'url' => 'https://microsoft.com',
|
||||||
'support_url' => 'https://support.microsoft.com'
|
'support_url' => 'https://support.microsoft.com',
|
||||||
|
'image' => 'microsoft.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -42,7 +44,8 @@ $factory->state(App\Models\Manufacturer::class, 'dell', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Dell',
|
'name' => 'Dell',
|
||||||
'url' => 'https://dell.com',
|
'url' => 'https://dell.com',
|
||||||
'support_url' => 'https://support.dell.com'
|
'support_url' => 'https://support.dell.com',
|
||||||
|
'image' => 'dell.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -51,7 +54,8 @@ $factory->state(App\Models\Manufacturer::class, 'asus', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Asus',
|
'name' => 'Asus',
|
||||||
'url' => 'https://asus.com',
|
'url' => 'https://asus.com',
|
||||||
'support_url' => 'https://support.asus.com'
|
'support_url' => 'https://support.asus.com',
|
||||||
|
'image' => 'asus.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -60,7 +64,8 @@ $factory->state(App\Models\Manufacturer::class, 'hp', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'HP',
|
'name' => 'HP',
|
||||||
'url' => 'https://hp.com',
|
'url' => 'https://hp.com',
|
||||||
'support_url' => 'https://support.hp.com'
|
'support_url' => 'https://support.hp.com',
|
||||||
|
'image' => 'hp.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -69,7 +74,8 @@ $factory->state(App\Models\Manufacturer::class, 'lenovo', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Lenovo',
|
'name' => 'Lenovo',
|
||||||
'url' => 'https://lenovo.com',
|
'url' => 'https://lenovo.com',
|
||||||
'support_url' => 'https://support.lenovo.com'
|
'support_url' => 'https://support.lenovo.com',
|
||||||
|
'image' => 'lenovo.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -78,7 +84,8 @@ $factory->state(App\Models\Manufacturer::class, 'lg', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'LG',
|
'name' => 'LG',
|
||||||
'url' => 'https://lg.com',
|
'url' => 'https://lg.com',
|
||||||
'support_url' => 'https://support.lg.com'
|
'support_url' => 'https://support.lg.com',
|
||||||
|
'image' => 'lg.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -87,7 +94,8 @@ $factory->state(App\Models\Manufacturer::class, 'polycom', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Polycom',
|
'name' => 'Polycom',
|
||||||
'url' => 'https://polycom.com',
|
'url' => 'https://polycom.com',
|
||||||
'support_url' => 'https://support.polycom.com'
|
'support_url' => 'https://support.polycom.com',
|
||||||
|
'image' => 'polycom.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -96,7 +104,8 @@ $factory->state(App\Models\Manufacturer::class, 'adobe', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Adobe',
|
'name' => 'Adobe',
|
||||||
'url' => 'https://adobe.com',
|
'url' => 'https://adobe.com',
|
||||||
'support_url' => 'https://support.adobe.com'
|
'support_url' => 'https://support.adobe.com',
|
||||||
|
'image' => 'adobe.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -106,7 +115,8 @@ $factory->state(App\Models\Manufacturer::class, 'avery', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Avery',
|
'name' => 'Avery',
|
||||||
'url' => 'https://avery.com',
|
'url' => 'https://avery.com',
|
||||||
'support_url' => 'https://support.avery.com'
|
'support_url' => 'https://support.avery.com',
|
||||||
|
'image' => 'avery.png',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -115,7 +125,8 @@ $factory->state(App\Models\Manufacturer::class, 'crucial', function ($faker) {
|
||||||
return [
|
return [
|
||||||
'name' => 'Crucial',
|
'name' => 'Crucial',
|
||||||
'url' => 'https://crucial.com',
|
'url' => 'https://crucial.com',
|
||||||
'support_url' => 'https://support.crucial.com'
|
'support_url' => 'https://support.crucial.com',
|
||||||
|
'image' => 'crucial.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,8 @@ $factory->define(App\Models\Location::class, function (Faker\Generator $faker) {
|
||||||
'state' => $faker->stateAbbr,
|
'state' => $faker->stateAbbr,
|
||||||
'country' => $faker->countryCode,
|
'country' => $faker->countryCode,
|
||||||
'currency' => $faker->currencyCode,
|
'currency' => $faker->currencyCode,
|
||||||
'zip' => $faker->postcode
|
'zip' => $faker->postcode,
|
||||||
|
'image' => rand(1,9).'.jpg',
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,23 @@ class AssetModelSeeder extends Seeder
|
||||||
factory(AssetModel::class, 1)->states('ultrafine')->create(); // 17
|
factory(AssetModel::class, 1)->states('ultrafine')->create(); // 17
|
||||||
factory(AssetModel::class, 1)->states('ultrasharp')->create(); // 18
|
factory(AssetModel::class, 1)->states('ultrasharp')->create(); // 18
|
||||||
|
|
||||||
|
$src = public_path('/img/demo/models');
|
||||||
|
$dst = public_path('/uploads/models');
|
||||||
|
|
||||||
|
$del_files = glob($dst."/*.*");
|
||||||
|
|
||||||
|
foreach($del_files as $del_file){ // iterate files
|
||||||
|
if(is_file($del_file))
|
||||||
|
unlink($del_file); // delete file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$add_files = glob($src."/*.*");
|
||||||
|
foreach($add_files as $add_file){
|
||||||
|
$file_to_copy = str_replace($src,$dst,$add_file);
|
||||||
|
copy($add_file, $file_to_copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,5 +35,15 @@ class AssetSeeder extends Seeder
|
||||||
factory(Asset::class, 10)->states('ultrasharp')->create();
|
factory(Asset::class, 10)->states('ultrasharp')->create();
|
||||||
|
|
||||||
|
|
||||||
|
$dst = public_path('/uploads/assets');
|
||||||
|
|
||||||
|
$del_files = glob($dst."/*.*");
|
||||||
|
|
||||||
|
foreach($del_files as $del_file){ // iterate files
|
||||||
|
if(is_file($del_file))
|
||||||
|
unlink($del_file); // delete file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,5 +15,23 @@ class CompanySeeder extends Seeder
|
||||||
//
|
//
|
||||||
Company::truncate();
|
Company::truncate();
|
||||||
factory(Company::class, 4)->create();
|
factory(Company::class, 4)->create();
|
||||||
|
|
||||||
|
$src = public_path('/img/demo/companies');
|
||||||
|
$dst = public_path('/uploads/companies');
|
||||||
|
|
||||||
|
$del_files = glob($dst."/*.*");
|
||||||
|
|
||||||
|
foreach($del_files as $del_file){ // iterate files
|
||||||
|
if(is_file($del_file))
|
||||||
|
unlink($del_file); // delete file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$add_files = glob($src."/*.*");
|
||||||
|
foreach($add_files as $add_file){
|
||||||
|
$file_to_copy = str_replace($src,$dst,$add_file);
|
||||||
|
copy($add_file, $file_to_copy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,6 +8,24 @@ class LocationSeeder extends Seeder
|
||||||
public function run()
|
public function run()
|
||||||
{
|
{
|
||||||
Location::truncate();
|
Location::truncate();
|
||||||
factory(Location::class, 30)->create();
|
factory(Location::class, 10)->create();
|
||||||
|
|
||||||
|
$src = public_path('/img/demo/locations');
|
||||||
|
$dst = public_path('/uploads/locations');
|
||||||
|
|
||||||
|
$del_files = glob($dst."/*.*");
|
||||||
|
|
||||||
|
foreach($del_files as $del_file){ // iterate files
|
||||||
|
if(is_file($del_file))
|
||||||
|
unlink($del_file); // delete file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$add_files = glob($src."/*.*");
|
||||||
|
foreach($add_files as $add_file){
|
||||||
|
$file_to_copy = str_replace($src,$dst,$add_file);
|
||||||
|
copy($add_file, $file_to_copy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,6 +17,27 @@ class ManufacturerSeeder extends Seeder
|
||||||
factory(Manufacturer::class, 1)->states('polycom')->create(); // 8
|
factory(Manufacturer::class, 1)->states('polycom')->create(); // 8
|
||||||
factory(Manufacturer::class, 1)->states('adobe')->create(); // 9
|
factory(Manufacturer::class, 1)->states('adobe')->create(); // 9
|
||||||
factory(Manufacturer::class, 1)->states('avery')->create(); // 10
|
factory(Manufacturer::class, 1)->states('avery')->create(); // 10
|
||||||
|
factory(Manufacturer::class, 1)->states('crucial')->create(); // 10
|
||||||
|
|
||||||
|
$src = public_path('/img/demo/manufacturers');
|
||||||
|
$dst = public_path('/uploads/manufacturers');
|
||||||
|
|
||||||
|
$del_files = glob($dst."/*.*");
|
||||||
|
|
||||||
|
foreach($del_files as $del_file){ // iterate files
|
||||||
|
if(is_file($del_file))
|
||||||
|
unlink($del_file); // delete file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$add_files = glob($src."/*.*");
|
||||||
|
foreach($add_files as $add_file){
|
||||||
|
$file_to_copy = str_replace($src,$dst,$add_file);
|
||||||
|
copy($add_file, $file_to_copy);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,5 +8,23 @@ class SupplierSeeder extends Seeder
|
||||||
{
|
{
|
||||||
Supplier::truncate();
|
Supplier::truncate();
|
||||||
factory(Supplier::class, 5)->create();
|
factory(Supplier::class, 5)->create();
|
||||||
|
|
||||||
|
$src = public_path('/img/demo/suppliers');
|
||||||
|
$dst = public_path('/uploads/suppliers');
|
||||||
|
|
||||||
|
$del_files = glob($dst."/*.*");
|
||||||
|
|
||||||
|
foreach($del_files as $del_file){ // iterate files
|
||||||
|
if(is_file($del_file))
|
||||||
|
unlink($del_file); // delete file
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
$add_files = glob($src."/*.*");
|
||||||
|
foreach($add_files as $add_file){
|
||||||
|
$file_to_copy = str_replace($src,$dst,$add_file);
|
||||||
|
copy($add_file, $file_to_copy);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,5 +18,6 @@ class UserSeeder extends Seeder
|
||||||
factory(User::class, 3)->states('superuser')->create();
|
factory(User::class, 3)->states('superuser')->create();
|
||||||
factory(User::class, 3)->states('admin')->create();
|
factory(User::class, 3)->states('admin')->create();
|
||||||
factory(User::class, 50)->states('view-assets')->create();
|
factory(User::class, 50)->states('view-assets')->create();
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
public/img/demo/locations/1.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/img/demo/locations/2.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/img/demo/locations/3.jpg
Normal file
After Width: | Height: | Size: 19 KiB |
BIN
public/img/demo/locations/4.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/img/demo/locations/5.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
public/img/demo/locations/6.jpg
Normal file
After Width: | Height: | Size: 13 KiB |
BIN
public/img/demo/locations/7.jpg
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
public/img/demo/locations/8.jpg
Normal file
After Width: | Height: | Size: 16 KiB |
BIN
public/img/demo/locations/9.jpg
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
public/img/demo/manufacturers/adobe.jpg
Normal file
After Width: | Height: | Size: 6.6 KiB |
BIN
public/img/demo/manufacturers/apple.jpg
Normal file
After Width: | Height: | Size: 7.2 KiB |
BIN
public/img/demo/manufacturers/asus.png
Normal file
After Width: | Height: | Size: 3.7 KiB |
BIN
public/img/demo/manufacturers/avery.png
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
public/img/demo/manufacturers/crucial.jpg
Normal file
After Width: | Height: | Size: 3 KiB |
BIN
public/img/demo/manufacturers/dell.png
Normal file
After Width: | Height: | Size: 8.7 KiB |
BIN
public/img/demo/manufacturers/hp.png
Normal file
After Width: | Height: | Size: 15 KiB |
BIN
public/img/demo/manufacturers/lenovo.jpg
Normal file
After Width: | Height: | Size: 4.1 KiB |
BIN
public/img/demo/manufacturers/lg.jpg
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
public/img/demo/manufacturers/microsoft.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
public/img/demo/manufacturers/polycom.png
Normal file
After Width: | Height: | Size: 8.5 KiB |
BIN
public/img/demo/models/cx3000.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
public/img/demo/models/imacpro.jpg
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
public/img/demo/models/ipad.jpg
Normal file
After Width: | Height: | Size: 46 KiB |
BIN
public/img/demo/models/iphone6.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
public/img/demo/models/iphone7.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
public/img/demo/models/lenovoi5.png
Normal file
After Width: | Height: | Size: 134 KiB |
BIN
public/img/demo/models/macbookair.jpg
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
public/img/demo/models/mbp.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
public/img/demo/models/optiplex.jpg
Normal file
After Width: | Height: | Size: 31 KiB |
BIN
public/img/demo/models/soundstation.jpg
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
public/img/demo/models/spectre.jpg
Normal file
After Width: | Height: | Size: 25 KiB |
BIN
public/img/demo/models/surface.jpg
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
public/img/demo/models/tab3.png
Normal file
After Width: | Height: | Size: 124 KiB |
BIN
public/img/demo/models/ultrafine.jpg
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
public/img/demo/models/ultrasharp.jpg
Normal file
After Width: | Height: | Size: 21 KiB |
BIN
public/img/demo/models/xps.jpg
Normal file
After Width: | Height: | Size: 24 KiB |
BIN
public/img/demo/models/yoga.png
Normal file
After Width: | Height: | Size: 152 KiB |
BIN
public/img/demo/models/zenbook.jpg
Normal file
After Width: | Height: | Size: 14 KiB |
Before Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 18 KiB |