Some More Cleanups And Issue Fixed On Configuration Portion
This commit is contained in:
parent
f9798a9e81
commit
8961e1ccfa
|
|
@ -2,31 +2,32 @@
|
|||
|
||||
namespace Webkul\Admin\Http\Controllers;
|
||||
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Webkul\Core\Repositories\CoreConfigRepository;
|
||||
use Webkul\Core\Tree;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Webkul\Admin\Http\Requests\ConfigurationForm;
|
||||
use Webkul\Core\Repositories\CoreConfigRepository;
|
||||
|
||||
class ConfigurationController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
* @var \Illuminate\Http\Response
|
||||
*/
|
||||
protected $_config;
|
||||
|
||||
/**
|
||||
* CoreConfigRepository object
|
||||
* Core config repository instance.
|
||||
*
|
||||
* @var \Webkul\Core\Repositories\CoreConfigRepository
|
||||
*/
|
||||
protected $coreConfigRepository;
|
||||
|
||||
/**
|
||||
* Tree instance.
|
||||
*
|
||||
* @var array
|
||||
* @var \Webkul\Core\Tree
|
||||
*/
|
||||
protected $configTree;
|
||||
|
||||
|
|
@ -48,7 +49,7 @@ class ConfigurationController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Prepares config tree
|
||||
* Prepares config tree.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
|
|
@ -82,7 +83,7 @@ class ConfigurationController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns slugs
|
||||
* Returns slugs.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -114,7 +115,7 @@ class ConfigurationController extends Controller
|
|||
{
|
||||
Event::dispatch('core.configuration.save.before');
|
||||
|
||||
$this->coreConfigRepository->create(request()->all());
|
||||
$this->coreConfigRepository->create($request->except(['_token', 'admin_locale']));
|
||||
|
||||
Event::dispatch('core.configuration.save.after');
|
||||
|
||||
|
|
@ -124,7 +125,7 @@ class ConfigurationController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* download the file for the specified resource.
|
||||
* Download the file for the specified resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
|
|
@ -132,7 +133,7 @@ class ConfigurationController extends Controller
|
|||
{
|
||||
$path = request()->route()->parameters()['path'];
|
||||
|
||||
$fileName = 'configuration/'. $path;
|
||||
$fileName = 'configuration/' . $path;
|
||||
|
||||
$config = $this->coreConfigRepository->findOneByField('value', $fileName);
|
||||
|
||||
|
|
@ -140,6 +141,8 @@ class ConfigurationController extends Controller
|
|||
}
|
||||
|
||||
/**
|
||||
* Get slugs.
|
||||
*
|
||||
* @param string $secondItem
|
||||
* @return array
|
||||
*/
|
||||
|
|
@ -149,4 +152,4 @@ class ConfigurationController extends Controller
|
|||
|
||||
return ['slug' => current($temp), 'slug2' => end($temp)];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
@php
|
||||
$allLocales = core()->getAllLocales()->pluck('name', 'code');
|
||||
|
||||
$currentLocaleCode = core()->getRequestedLocaleCode();
|
||||
$currentLocaleCode = core()->getRequestedLocaleCode('admin_locale');
|
||||
@endphp
|
||||
|
||||
<div class="dropdown-toggle">
|
||||
|
|
|
|||
|
|
@ -318,9 +318,9 @@ class Core
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRequestedLocaleCode(): string
|
||||
public function getRequestedLocaleCode($localeCode = 'locale'): string
|
||||
{
|
||||
return request()->get('locale') ?: app()->getLocale();
|
||||
return request()->get($localeCode) ?: app()->getLocale();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -26,8 +26,6 @@ class CoreConfigRepository extends Repository
|
|||
*/
|
||||
public function create(array $data)
|
||||
{
|
||||
unset($data['_token']);
|
||||
|
||||
if ($data['locale'] || $data['channel']) {
|
||||
$locale = $data['locale'];
|
||||
$channel = $data['channel'];
|
||||
|
|
|
|||
Loading…
Reference in New Issue