Fixed pathing for accessories

This commit is contained in:
snipe 2020-08-03 11:17:56 -07:00
parent 502b3c50a9
commit 6a089f86f8
No known key found for this signature in database
GPG key ID: 10BFFDA3ED34B5AC
6 changed files with 18 additions and 46 deletions

View file

@ -79,8 +79,8 @@ class AccessoriesController extends Controller
$accessory->user_id = Auth::user()->id;
$accessory->supplier_id = request('supplier_id');
$accessory = $request->handleImages($accessory, 500, 'image', 'public/uploads');
$accessory = $request->handleImages($accessory);
// Was the accessory created?
if ($accessory->save()) {
// Redirect to the new accessory page

View file

@ -49,7 +49,7 @@ class ImageUploadRequest extends Request
$type = strtolower(class_basename(get_class($item)));
if (is_null($path)) {
$path = 'public/uploads/'.str_plural($type);
$path = str_plural($type);
\Log::info('Path is: '.$path);
}

View file

@ -24,7 +24,7 @@ class AccessoriesTransformer
$array = [
'id' => $accessory->id,
'name' => e($accessory->name),
'image' => ($accessory->image) ? Storage::disk('public')->url('uploads/accessories/'.e($accessory->image)) : null,
'image' => ($accessory->image) ? Storage::disk('public')->url('accessories/'.e($accessory->image)) : null,
'company' => ($accessory->company) ? ['id' => $accessory->company->id,'name'=> e($accessory->company->name)] : null,
'manufacturer' => ($accessory->manufacturer) ? ['id' => $accessory->manufacturer->id,'name'=> e($accessory->manufacturer->name)] : null,
'supplier' => ($accessory->supplier) ? ['id' => $accessory->supplier->id,'name'=> e($accessory->supplier->name)] : null,

View file

@ -71,7 +71,7 @@ class SettingsServiceProvider extends ServiceProvider
});
\App::singleton('locations_upload_url', function(){
return 'storage/public_uploads/locations/';
return 'locations/';
});
// Users
@ -80,7 +80,7 @@ class SettingsServiceProvider extends ServiceProvider
});
\App::singleton('users_upload_url', function(){
return 'public_uploads/users/';
return 'users/';
});
// Manufacturers
@ -89,7 +89,7 @@ class SettingsServiceProvider extends ServiceProvider
});
\App::singleton('manufacturers_upload_url', function(){
return 'public_uploads/manufacturers/';
return 'manufacturers/';
});
// Suppliers
@ -98,7 +98,7 @@ class SettingsServiceProvider extends ServiceProvider
});
\App::singleton('suppliers_upload_url', function(){
return 'storage/public_uploads/suppliers/';
return 'suppliers/';
});
// Departments
@ -116,63 +116,35 @@ class SettingsServiceProvider extends ServiceProvider
});
\App::singleton('companies_upload_url', function(){
return 'storage/public_uploads/companies/';
return 'companies/';
});
// Accessories paths and URLs
\App::singleton('accessories_upload_path', function(){
return public_path('/uploads/accessories/');
return 'accessories/';
});
\App::singleton('accessories_upload_url', function(){
return url('/').'/uploads/accessories/';
return 'accessories/';
});
// Consumables paths and URLs
\App::singleton('consumables_upload_path', function(){
return public_path('/uploads/consumables/');
return 'consumables/';
});
\App::singleton('consumables_upload_url', function(){
return url('/').'/uploads/consumables/';
return 'consumables/';
});
// Components paths and URLs
\App::singleton('components_upload_path', function(){
return public_path('/uploads/components/');
return 'components/';
});
\App::singleton('components_upload_url', function(){
return url('/').'/uploads/components/';
});
// Accessories paths and URLs
\App::singleton('accessories_upload_path', function(){
return public_path('/uploads/accessories/');
});
\App::singleton('accessories_upload_url', function(){
return url('/').'/uploads/accessories/';
});
// Consumables paths and URLs
\App::singleton('consumables_upload_path', function(){
return public_path('/uploads/consumables/');
});
\App::singleton('consumables_upload_url', function(){
return url('/').'/uploads/consumables/';
});
// Components paths and URLs
\App::singleton('components_upload_path', function(){
return public_path('/uploads/components/');
});
\App::singleton('components_upload_url', function(){
return url('/').'/uploads/components/';
return 'components/';
});

View file

@ -19,8 +19,8 @@
"/css/dist/skins/skin-orange-dark.css": "/css/dist/skins/skin-orange-dark.css?id=71c178700d68294e3413",
"/css/dist/skins/skin-orange.css": "/css/dist/skins/skin-orange.css?id=b4fc4a74e1f6367dc3e2",
"/css/dist/all.css": "/css/dist/all.css?id=cd644954b1fc39b7f25b",
"/css/blue.png": "/css/blue.png?id=e83a6c29e04fe851f212",
"/css/blue@2x.png": "/css/blue@2x.png?id=51135dd4d24f88f5de0b",
"/css/blue.png": "/css/blue.png?id=4c85d6a97173123bd14a",
"/css/blue@2x.png": "/css/blue@2x.png?id=62c67c6a822439e8a4ac",
"/css/dist/skins/skin-green-dark.min.css": "/css/dist/skins/skin-green-dark.min.css?id=0cfa39cacd9c83b4f53b",
"/css/dist/skins/skin-black-dark.min.css": "/css/dist/skins/skin-black-dark.min.css?id=6bd9c2420a41eaf96f0b",
"/css/dist/skins/skin-blue-dark.min.css": "/css/dist/skins/skin-blue-dark.min.css?id=2f665cf40d7348b3f94c",

View file

@ -92,7 +92,7 @@
@if ($accessory->image!='')
<div class="col-md-12 text-center" style="padding-bottom: 15px;">
<a href="{{ app('accessories_upload_url') }}{{ $accessory->image }}" data-toggle="lightbox"><img src="{{ app('accessories_upload_url') }}{{ $accessory->image }}" class="img-responsive img-thumbnail" alt="{{ $accessory->name }}"></a>
<a href="{{ Storage::disk('public')->url('accessories/'.e($accessory->image)) }}" data-toggle="lightbox"><img src="{{ Storage::disk('public')->url('accessories/'.e($accessory->image)) }}" class="img-responsive img-thumbnail" alt="{{ $accessory->name }}"></a>
</div>
@endif