file & image attribute
This commit is contained in:
parent
b8561d4d5e
commit
c4a9d04e72
|
|
@ -433,7 +433,9 @@ return [
|
|||
'color-swatch' => 'Color Swatch',
|
||||
'image-swatch' => 'Image Swatch',
|
||||
'text-swatch' => 'Text Swatch',
|
||||
'swatch' => 'Swatch'
|
||||
'swatch' => 'Swatch',
|
||||
'image' => 'Image',
|
||||
'file' => 'File'
|
||||
],
|
||||
'families' => [
|
||||
'title' => 'Families',
|
||||
|
|
|
|||
|
|
@ -52,6 +52,8 @@
|
|||
<option value="multiselect">{{ __('admin::app.catalog.attributes.multiselect') }}</option>
|
||||
<option value="datetime">{{ __('admin::app.catalog.attributes.datetime') }}</option>
|
||||
<option value="date">{{ __('admin::app.catalog.attributes.date') }}</option>
|
||||
<option value="image">{{ __('admin::app.catalog.attributes.image') }}</option>
|
||||
<option value="file">{{ __('admin::app.catalog.attributes.file') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -71,6 +71,12 @@
|
|||
<option value="date" {{ $selectedOption == 'date' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.attributes.date') }}
|
||||
</option>
|
||||
<option value="image" {{ $selectedOption == 'image' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.attributes.image') }}
|
||||
</option>
|
||||
<option value="file" {{ $selectedOption == 'file' ? 'selected' : '' }}>
|
||||
{{ __('admin::app.catalog.attributes.file') }}
|
||||
</option>
|
||||
</select>
|
||||
<input type="hidden" name="type" value="{{ $attribute->type }}"/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
@if ($product[$attribute->code])
|
||||
<a href="{{ Storage::url($product[$attribute->code]) }}" target="_blank">
|
||||
<i class="icon sort-down-icon download"></i>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
<input type="file" v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" data-vv-as=""{{ $attribute->admin_name }}"" {{ $disabled ? 'disabled' : '' }} style="padding-top: 5px;"/>
|
||||
|
||||
@if ($product[$attribute->code])
|
||||
<div class="control-group" style="margin-top: 5px;">
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="{{ $attribute->code }}[delete]" name="{{ $attribute->code }}[delete]" value="1">
|
||||
|
||||
<label class="checkbox-view" for="delete"></label>
|
||||
{{ __('admin::app.configuration.delete') }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
@if ($product[$attribute->code])
|
||||
<a href="{{ Storage::url($product[$attribute->code]) }}" target="_blank">
|
||||
<img src="{{ Storage::url($product[$attribute->code]) }}" class="configuration-image"/>
|
||||
</a>
|
||||
@endif
|
||||
|
||||
<input type="file" v-validate="'{{$validations}}'" class="control" id="{{ $attribute->code }}" name="{{ $attribute->code }}" value="{{ old($attribute->code) ?: $product[$attribute->code] }}" data-vv-as=""{{ $attribute->admin_name }}"" {{ $disabled ? 'disabled' : '' }} style="padding-top: 5px;"/>
|
||||
|
||||
@if ($product[$attribute->code])
|
||||
<div class="control-group" style="margin-top: 5px;">
|
||||
<span class="checkbox">
|
||||
<input type="checkbox" id="{{ $attribute->code }}[delete]" name="{{ $attribute->code }}[delete]" value="1">
|
||||
|
||||
<label class="checkbox-view" for="delete"></label>
|
||||
{{ __('admin::app.configuration.delete') }}
|
||||
</span>
|
||||
</div>
|
||||
@endif
|
||||
|
|
@ -30,6 +30,7 @@ class View extends AbstractProduct
|
|||
'label' => $attribute->name,
|
||||
'value' => $value,
|
||||
'admin_name' => $attribute->admin_name,
|
||||
'type' => $attribute->type,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -66,6 +66,8 @@ class ProductFlat
|
|||
'multiselect' => 'text',
|
||||
'datetime' => 'datetime',
|
||||
'date' => 'date',
|
||||
'file' => 'text',
|
||||
'image' => 'text',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -25,6 +25,8 @@ class ProductAttributeValue extends Model implements ProductAttributeValueContra
|
|||
'multiselect' => 'text_value',
|
||||
'datetime' => 'datetime_value',
|
||||
'date' => 'date_value',
|
||||
'file' => 'text_value',
|
||||
'image' => 'text_value',
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
|
|
|
|||
|
|
@ -164,6 +164,15 @@ class ProductRepository extends Repository
|
|||
$data[$attribute->code] = implode(",", $data[$attribute->code]);
|
||||
}
|
||||
|
||||
if ($attribute->type == 'image' || $attribute->type == 'file') {
|
||||
$dir = 'test';
|
||||
if (gettype($data[$attribute->code]) == 'object') {
|
||||
$data[$attribute->code] = request()->file($attribute->code)->store($dir);
|
||||
} else {
|
||||
$data[$attribute->code] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
$attributeValue = $this->attributeValue->findOneWhere([
|
||||
'product_id' => $product->id,
|
||||
'attribute_id' => $attribute->id,
|
||||
|
|
@ -184,6 +193,10 @@ class ProductRepository extends Repository
|
|||
ProductAttributeValue::$attributeTypeFields[$attribute->type] => $data[$attribute->code]
|
||||
], $attributeValue->id
|
||||
);
|
||||
|
||||
if ($attribute->type == 'image' || $attribute->type == 'file') {
|
||||
Storage::delete($attributeValue->text_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/shop.js": "/js/shop.js?id=ad1039174ce2c81c8805",
|
||||
"/js/shop.js": "/js/shop.js?id=71f03d05d9690fe24784",
|
||||
"/css/shop.css": "/css/shop.css?id=5f540e896d70e1d6cc49"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,14 +13,31 @@
|
|||
<table class="full-specifications">
|
||||
|
||||
@foreach ($customAttributeValues as $attribute)
|
||||
|
||||
<tr>
|
||||
@if ($attribute['label'])
|
||||
<td>{{ $attribute['label'] }}</td>
|
||||
@else
|
||||
<td>{{ $attribute['admin_name'] }}</td>
|
||||
@endif
|
||||
<td>{{ $attribute['value'] }}</td>
|
||||
@if ($attribute['type'] == 'file')
|
||||
<td>
|
||||
@if ($attribute['value'])
|
||||
<a href="{{ Storage::url($attribute['value']) }}" target="_blank">
|
||||
<i class="icon sort-down-icon download"></i>
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
@elseif ($attribute['type'] == 'image')
|
||||
<td>
|
||||
@if ($attribute['value'])
|
||||
<a href="{{ Storage::url($attribute['value']) }}" target="_blank">
|
||||
<img src="{{ Storage::url($attribute['value']) }}" style="height: 20px; width: 20px;"/>
|
||||
</a>
|
||||
@endif
|
||||
</td>
|
||||
@else
|
||||
<td>{{ $attribute['value'] }}</td>
|
||||
@endif
|
||||
</tr>
|
||||
|
||||
@endforeach
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -1,4 +1,4 @@
|
|||
{
|
||||
"/js/ui.js": "/js/ui.js?id=d2b67f9707c2727a06a5",
|
||||
"/js/ui.js": "/js/ui.js?id=97343143e38eeba34064",
|
||||
"/css/ui.css": "/css/ui.css?id=f912bd2a6525691bdb61"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ namespace Webkul\User\Http\Controllers;
|
|||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
use Auth;
|
||||
use File;
|
||||
|
||||
/**
|
||||
* Admin user session controller
|
||||
|
|
@ -43,10 +42,6 @@ class SessionController extends Controller
|
|||
*/
|
||||
public function create()
|
||||
{
|
||||
if (File::exists(public_path('installer'))) {
|
||||
File::deleteDirectory(public_path('installer'));
|
||||
}
|
||||
|
||||
if (auth()->guard('admin')->check()) {
|
||||
return redirect()->route('admin.dashboard.index');
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in New Issue