Merge branch 'velocity-1' into prateek-latest1
This commit is contained in:
commit
2fcd1a4b76
|
|
@ -1721,6 +1721,7 @@
|
|||
}
|
||||
|
||||
.product-price .sticker {
|
||||
display: none;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border: none;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ class CreateVelocityMetaData extends Migration
|
|||
$table->text('home_page_content');
|
||||
$table->text('footer_left_content');
|
||||
$table->text('footer_middle_content');
|
||||
$table->boolean('slider');
|
||||
$table->boolean('slider')->default(0);
|
||||
|
||||
$table->timestamps();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -53,20 +53,20 @@ class Helper extends Review
|
|||
*
|
||||
* @var object
|
||||
*/
|
||||
protected $velocityMetadata;
|
||||
protected $velocityMetadataRepository;
|
||||
|
||||
public function __construct(
|
||||
VelocityMetadataRepository $velocityMetadata,
|
||||
VelocityMetadataRepository $velocityMetadataRepository,
|
||||
OrderBrandsRepository $orderBrandsRepository,
|
||||
ProductRepository $productRepository,
|
||||
ProductModel $productModel,
|
||||
AttributeOptionRepository $attributeOption
|
||||
) {
|
||||
$this->velocityMetadata = $velocityMetadata;
|
||||
$this->productModel = $productModel;
|
||||
$this->attributeOption = $attributeOption;
|
||||
$this->productRepository = $productRepository;
|
||||
$this->orderBrandsRepository = $orderBrandsRepository;
|
||||
$this->velocityMetadataRepository = $velocityMetadataRepository;
|
||||
}
|
||||
|
||||
public function topBrand($order)
|
||||
|
|
@ -172,13 +172,16 @@ class Helper extends Review
|
|||
|
||||
public function getVelocityMetaData()
|
||||
{
|
||||
$metaData = $this->velocityMetadata->get();
|
||||
try {
|
||||
$metaData = $this->velocityMetadataRepository->get();
|
||||
|
||||
if (! ($metaData && ($metaData = $metaData[0]))) {
|
||||
if (! ($metaData && isset($metaData[0]) && $metaData = $metaData[0])) {
|
||||
$metaData = null;
|
||||
}
|
||||
|
||||
return $metaData;
|
||||
} catch (\Exception $exception) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace Webkul\Velocity\Http\Controllers\Admin;
|
|||
|
||||
use DB;
|
||||
use Webkul\Velocity\Repositories\MetadataRepository;
|
||||
use Webkul\Velocity\Repositories\VelocityMetadataRepository;
|
||||
|
||||
/**
|
||||
* Category Controller
|
||||
|
|
@ -15,11 +16,11 @@ use Webkul\Velocity\Repositories\MetadataRepository;
|
|||
class ConfigurationController extends Controller
|
||||
{
|
||||
/**
|
||||
* MetadataRepository object
|
||||
* VelocityMetadataRepository object
|
||||
*
|
||||
* @var Object
|
||||
*/
|
||||
protected $metaDataRepository;
|
||||
protected $velocityMetaDataRepository;
|
||||
|
||||
/**
|
||||
* Create a new controller instance.
|
||||
|
|
@ -27,19 +28,38 @@ class ConfigurationController extends Controller
|
|||
* @param \Webkul\Velocity\Repositories\MetadataRepository $metaDataRepository
|
||||
*/
|
||||
|
||||
public function __construct ()
|
||||
{
|
||||
public function __construct (
|
||||
VelocityMetadataRepository $velocityMetadataRepository
|
||||
) {
|
||||
$this->_config = request('_config');
|
||||
|
||||
$this->velocityMetaDataRepository = $velocityMetadataRepository;
|
||||
}
|
||||
|
||||
public function storeMetaData()
|
||||
public function renderMetaData()
|
||||
{
|
||||
$metaData = DB::table('velocity_meta_data')->get();
|
||||
$velocityHelper = app('Webkul\Velocity\Helpers\Helper');
|
||||
$velocityMetaData = $velocityHelper->getVelocityMetaData();
|
||||
|
||||
if (! ($metaData && ($metaData = $metaData[0]))) {
|
||||
$metaData = null;
|
||||
return view($this->_config['view'], [
|
||||
'metaData' => $velocityMetaData
|
||||
]);
|
||||
}
|
||||
|
||||
return view($this->_config['view'], compact('metaData'));
|
||||
public function storeMetaData($id)
|
||||
{
|
||||
if (! request()->get('slider')) {
|
||||
$params = request()->all() + [
|
||||
'slider' => 0
|
||||
];
|
||||
} else {
|
||||
$params = request()->all();
|
||||
}
|
||||
|
||||
$product = $this->velocityMetaDataRepository->update($params, $id);
|
||||
|
||||
session()->flash('success', trans('admin::app.response.update-success', ['name' => 'Velocity Theme']));
|
||||
|
||||
return redirect()->route($this->_config['redirect']);
|
||||
}
|
||||
}
|
||||
|
|
@ -63,9 +63,13 @@ Route::group(['middleware' => ['web']], function () {
|
|||
'redirect' => 'velocity.admin.category.index'
|
||||
])->name('velocity.admin.category.mass-delete');
|
||||
|
||||
Route::get('/meta-data', 'ConfigurationController@storeMetaData')->defaults('_config', [
|
||||
Route::get('/meta-data', 'ConfigurationController@renderMetaData')->defaults('_config', [
|
||||
'view' => 'velocity::admin.meta-info.meta-data'
|
||||
])->name('velocity.admin.meta-data');
|
||||
|
||||
Route::post('/meta-data/{id}', 'ConfigurationController@storeMetaData')->defaults('_config', [
|
||||
'redirect' => 'velocity.admin.meta-data'
|
||||
])->name('velocity.admin.store.meta-data');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -8,4 +8,7 @@ use Webkul\Velocity\Contracts\VelocityMetadata as VelocityMetadataContract;
|
|||
class VelocityMetadata extends Model implements VelocityMetadataContract
|
||||
{
|
||||
protected $table = 'velocity_meta_data';
|
||||
|
||||
protected $guarded = [];
|
||||
|
||||
}
|
||||
|
|
@ -1016,6 +1016,7 @@
|
|||
|
||||
.product-price {
|
||||
.sticker {
|
||||
display: none;
|
||||
top: 0;
|
||||
left: 0;
|
||||
border: none;
|
||||
|
|
|
|||
|
|
@ -93,6 +93,7 @@ return [
|
|||
'title' => 'Velocity meta data',
|
||||
'home-page-content' => 'Home Page Content',
|
||||
'footer-left-content' => 'Footer Left Content',
|
||||
'activate-slider' => 'Activate Slider',
|
||||
'footer-left-raw-content' => 'We love to craft softwares and solve the real world problems with the binaries. We are highly committed to our goals. We invest our resources to create world class easy to use softwares and applications for the enterprise business with the top notch, on the edge technology expertise.',
|
||||
'footer-middle-content' => 'Footer Middle Content',
|
||||
'update-meta-data' => 'Update Meta Data',
|
||||
|
|
|
|||
|
|
@ -13,16 +13,29 @@
|
|||
</div>
|
||||
|
||||
<form
|
||||
action=""
|
||||
action="{{ route('velocity.admin.store.meta-data', ['id' => $metaData->id]) }}"
|
||||
method="POST"
|
||||
@submit.prevent="onSubmit">
|
||||
|
||||
@csrf
|
||||
|
||||
@php
|
||||
$typeView = 'admin::catalog.products.field-types.boolean';
|
||||
@endphp
|
||||
<div class="control-group">
|
||||
<label for="footer_content">
|
||||
{{ __('velocity::app.admin.meta-data.activate-slider') }}
|
||||
</label>
|
||||
|
||||
{{-- @include ($typeView) --}}
|
||||
<label class="switch">
|
||||
<input
|
||||
type="checkbox"
|
||||
class="control"
|
||||
id="slider"
|
||||
name="slider"
|
||||
data-vv-as=""slides""
|
||||
{{ $metaData->slider ? 'checked' : ''}}
|
||||
value="{{ $metaData->slider }}" />
|
||||
<span class="slider round"></span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="control-group">
|
||||
<label for="footer_content">
|
||||
|
|
|
|||
Loading…
Reference in New Issue