Merge branch 'develop' into move-file-uploads-paths-to-base-controller
This commit is contained in:
@@ -71,25 +71,25 @@ class ImageUploadRequest extends Request
|
||||
public function handleImages($item, $w = 600, $form_fieldname = 'image', $path = null, $db_fieldname = 'image')
|
||||
{
|
||||
|
||||
$type = Str::snake(class_basename(get_class($item)));
|
||||
$type = class_basename(get_class($item));
|
||||
|
||||
if (is_null($path)) {
|
||||
|
||||
\Log::debug('path is null');
|
||||
$path = Str::of(str_plural($type))->snake();
|
||||
$path = strtolower(str_plural($type));
|
||||
|
||||
if ($type == 'assetmodel') {
|
||||
if ($type == 'AssetModel') {
|
||||
$path = 'models';
|
||||
}
|
||||
|
||||
if ($type == 'user') {
|
||||
$path = 'avatars';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!Storage::exists($path)) {
|
||||
Storage::makeDirectory($path);
|
||||
if (!Storage::disk('public')->exists($path)) {
|
||||
Storage::disk('public')->makeDirectory($path);
|
||||
}
|
||||
|
||||
if ($this->offsetGet($form_fieldname) instanceof UploadedFile) {
|
||||
@@ -100,7 +100,6 @@ class ImageUploadRequest extends Request
|
||||
|
||||
if (isset($image)) {
|
||||
|
||||
if (!config('app.lock_passwords')) {
|
||||
|
||||
$ext = $image->guessExtension();
|
||||
$file_name = $type.'-'.$form_fieldname.($item->id ?? '-'.$item->id).'-'.str_random(10).'.'.$ext;
|
||||
@@ -145,7 +144,7 @@ class ImageUploadRequest extends Request
|
||||
// Remove Current image if exists
|
||||
$item = $this->deleteExistingImage($item, $path, $db_fieldname);
|
||||
$item->{$db_fieldname} = $file_name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// If the user isn't uploading anything new but wants to delete their old image, do so
|
||||
|
||||
@@ -491,7 +491,7 @@ class Actionlog extends SnipeModel
|
||||
case Asset::class:
|
||||
return 'private_uploads/assets/'.$this->filename;
|
||||
case AssetModel::class:
|
||||
return 'private_uploads/assetmodels/'.$this->filename;
|
||||
return 'private_uploads/models/'.$this->filename;
|
||||
case Consumable::class:
|
||||
return 'private_uploads/consumables/'.$this->filename;
|
||||
case Component::class:
|
||||
|
||||
@@ -651,7 +651,7 @@ dir="{{ Helper::determineLanguageDirection() }}">
|
||||
@endcan
|
||||
|
||||
@can('view', \App\Models\User::class)
|
||||
<li id="users-sidenav-option"{!! (request()->is('users*') ? ' class="active"' : '') !!}>
|
||||
<li class="treeview{{ (request()->is('users*') ? ' active' : '') }}" id="users-sidenav-option">
|
||||
<a href="#" {{$snipeSettings->shortcuts_enabled == 1 ? "accesskey=6" : ''}}>
|
||||
<x-icon type="users" class="fa-fw" />
|
||||
<span>{{ trans('general.people') }}</span>
|
||||
|
||||
Reference in New Issue
Block a user