This commit is contained in:
Prashant Singh 2019-08-20 16:07:41 +05:30
parent 46e3badf4d
commit 07be3c6a86
3 changed files with 40 additions and 15 deletions

View File

@ -93,7 +93,7 @@
<datetime :name="starts_from">
<div class="control-group" :class="[errors.has('starts_from') ? 'has-error' : '']">
<label for="starts_from" class="required">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<label for="starts_from">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<input type="text" class="control" v-model="starts_from" name="starts_from" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.starts-from') }}&quot;">
@ -103,7 +103,7 @@
<datetime :name="starts_from">
<div class="control-group" :class="[errors.has('ends_till') ? 'has-error' : '']">
<label for="ends_till" class="required">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<label for="ends_till">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<input type="text" class="control" v-model="ends_till" name="ends_till" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.ends-till') }}&quot;">
@ -260,7 +260,6 @@
},
mounted () {
console.log(this.attribute_input);
},
methods: {

View File

@ -97,7 +97,7 @@
<date :name="starts_from">
<div class="control-group" :class="[errors.has('starts_from') ? 'has-error' : '']">
<label for="starts_from" class="required">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<label for="starts_from">{{ __('admin::app.promotion.general-info.starts-from') }}</label>
<input type="text" class="control" v-model="starts_from" name="starts_from" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.starts-from') }}&quot;">
@ -107,7 +107,7 @@
<date :name="starts_from">
<div class="control-group" :class="[errors.has('ends_till') ? 'has-error' : '']">
<label for="ends_till" class="required">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<label for="ends_till">{{ __('admin::app.promotion.general-info.ends-till') }}</label>
<input type="text" class="control" v-model="ends_till" name="ends_till" data-vv-as="&quot;{{ __('admin::app.promotion.general-info.ends-till') }}&quot;">

View File

@ -85,16 +85,42 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
*/
public function store()
{
$this->validate(request(), [
'channels' => 'required',
'locales' => 'required',
'url_key' => 'required|unique:cms_pages,url_key',
'html_content' => 'required|string',
'page_title' => 'required|string',
'meta_title' => 'required|string',
'meta_description' => 'string',
'meta_keywords' => 'required|string'
]);
$data = request()->all();
$channels = request()->input('channels');
$locales = request()->input('locales');
$urlKey = request()->input('url_key');
$ignorePageIDs = array();
foreach ($channels as $channel) {
foreach ($locales as $locale) {
$page = $this->cms->findOneWhere([
'channel_id' => $channel,
'locale_id' => $locale,
'url_key' => $urlKey
]);
if ($page) {
array_push($ignorePageIDs, $page->id);
}
}
}
if (count($ignorePageIDs)) {
$this->validate(request(), [
'channels' => 'required',
'locales' => 'required',
'url_key' => 'required|unique:cms_pages,url_key,'.$ignorePageIDs,
'html_content' => 'required|string',
'page_title' => 'required|string',
'meta_title' => 'required|string',
'meta_description' => 'string',
'meta_keywords' => 'required|string'
]);
}
$data = request()->all();