WIP: CMS Pages fix in progress

This commit is contained in:
Prashant Singh 2019-08-20 19:21:20 +05:30
parent 3a9143462e
commit f3b532adef
1 changed files with 32 additions and 8 deletions

View File

@ -94,13 +94,37 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
'url_key' => 'required'
]);
$urlKey = request()->input('url_key');
// generate locked records combinations
$allChannels = $this->channel->all(['id']);
$allLocales = $this->locale->all(['id']);
$allCross = $allChannels->crossJoin($allLocales);
$pages = collect();
foreach ($allCross as $singleCross) {
$channel = $singleCross[0]->id;
$locale = $singleCross[1]->id;
$page = $this->cms->findOneWhere([
'channel_id' => $channel,
'locale_id' => $locale,
'url_key' => $urlKey
]);
if ($page) {
$pages->push($page);
}
}
$channels = request()->input('channels');
$locales = request()->input('locales');
$urlKey = request()->input('url_key');
$ignorePageIDs = array();
// $ignorePageIDs = array();
foreach ($channels as $channel) {
foreach ($locales as $locale) {
@ -116,11 +140,11 @@ use Webkul\Core\Repositories\LocaleRepository as Locale;
}
}
if (! count($ignorePageIDs)) {
$this->validate(request(), [
'url_key' => 'unique:cms_pages,url_key,'
]);
}
// if (! count($ignorePageIDs)) {
// $this->validate(request(), [
// 'url_key' => 'unique:cms_pages,url_key,'
// ]);
// }
$this->validate(request(), [
'channels' => 'required',