Merge branch 'multilanguage' into dev
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace App\Console\Commands;
|
||||
|
||||
use App\Models\Language;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
class AddLanguage extends Command
|
||||
{
|
||||
/**
|
||||
* The name and signature of the console command.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $signature = 'language:add {code} {translation} {native} {script?}';
|
||||
/**
|
||||
* The console command description.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $description = 'Insert new language into database';
|
||||
|
||||
/**
|
||||
* Create a new command instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the console command.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
$code = $this->argument('code');
|
||||
$translation = $this->argument('translation');
|
||||
$native = $this->argument('native');
|
||||
$script = $this->argument('script');
|
||||
|
||||
// check if language does not exist
|
||||
$exist = Language::find($code);
|
||||
|
||||
if ($exist) {
|
||||
$this->error('Language ' . $code . ' already exists!');
|
||||
return;
|
||||
}
|
||||
|
||||
Language::create([
|
||||
'code' => $code,
|
||||
'name' => $translation,
|
||||
'native' => $native,
|
||||
'script' => $script ? $script : 'Latn'
|
||||
]);
|
||||
|
||||
$this->line('Successfully installed.');
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,10 @@ class Translations extends Command
|
||||
$defaultLocalesDir = $dir . '/' . $defaultLocales;
|
||||
$currentLocalesDir = $dir . '/' . $currentLocales;
|
||||
|
||||
if (!is_dir($currentLocalesDir)) {
|
||||
File::makeDirectory($currentLocalesDir);
|
||||
}
|
||||
|
||||
$this->compareTranslationsInDirectory($defaultLocalesDir, $currentLocalesDir);
|
||||
}
|
||||
|
||||
@@ -57,7 +61,7 @@ class Translations extends Command
|
||||
$default = include($file);
|
||||
$checked = file_exists($currentDir . '/' . $fileName) ? include $currentDir . '/' . $fileName : [];
|
||||
$this->translations = &$checked;
|
||||
|
||||
|
||||
$this->checkForMissingTranslations($default, $checked, $currentDir, $fileName);
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Console;
|
||||
|
||||
use App\Console\Commands\AddLanguage;
|
||||
use Illuminate\Console\Scheduling\Schedule;
|
||||
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
|
||||
|
||||
@@ -21,6 +22,7 @@ class Kernel extends ConsoleKernel
|
||||
Commands\TranslateAll::class,
|
||||
Commands\InitDatabaseSchema::class,
|
||||
Commands\SetTheme::class,
|
||||
AddLanguage::class
|
||||
];
|
||||
|
||||
/**
|
||||
|
||||
@@ -11,6 +11,7 @@ use App\Models\WidgetArea;
|
||||
use App\Models\WidgetInWidgetArea;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class AssociateWidget extends Controller
|
||||
{
|
||||
@@ -18,7 +19,8 @@ class AssociateWidget extends Controller
|
||||
{
|
||||
$area = WidgetArea::findOrFail($widgetArea);
|
||||
$associatedWidgetIds = WidgetInWidgetArea::getWidgetIdsFromArea($area->id);
|
||||
$widgets = Widget::paginate(25);
|
||||
$widgets = Widget::where('language', LaravelLocalization::getCurrentLocale())
|
||||
->paginate(25);
|
||||
|
||||
return view('admin.widgets.association', [
|
||||
'widgetArea' => $area,
|
||||
|
||||
@@ -10,6 +10,7 @@ use App\Models\Module;
|
||||
use App\Models\Template;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Str;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class CreateNewContent extends Controller
|
||||
@@ -56,7 +57,8 @@ class CreateNewContent extends Controller
|
||||
'templates' => $templates,
|
||||
'moduleId' => $moduleId,
|
||||
'page' => $this->content,
|
||||
'rootPages' => $this->content->getOverview()->get(),
|
||||
'rootPages' => $this->content->getOverview()
|
||||
->get(),
|
||||
'moduleName' => trans($module->name),
|
||||
'extraData' => call_user_func([$module->handler, 'loadExtraData'], $this->content),
|
||||
'formSectionNames' => call_user_func([$module->handler, 'getExtendedFormSections']),
|
||||
@@ -86,6 +88,7 @@ class CreateNewContent extends Controller
|
||||
|
||||
// setup basic info
|
||||
$page->user_id = \Auth::user()->id;
|
||||
$page->language = LaravelLocalization::getLocale();
|
||||
$page->title = $request->title;
|
||||
$page->url = Str::slug($request->url);
|
||||
$page->published_from = $request->publishedFrom;
|
||||
@@ -112,7 +115,7 @@ class CreateNewContent extends Controller
|
||||
call_user_func_array([$module->handler, 'createNew'], [&$page, $request]);
|
||||
|
||||
$page->save();
|
||||
|
||||
|
||||
// fire event about creating new content page
|
||||
Event::fire(new CreateNewContentEvent($page));
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ use App\Models\File;
|
||||
use App\Models\Template;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Illuminate\Support\Str;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
class EditContent extends Controller
|
||||
@@ -65,8 +66,8 @@ class EditContent extends Controller
|
||||
'contentStatuses' => $statuses,
|
||||
'page' => $page,
|
||||
'rootPages' => $page->getOverview()
|
||||
->where('contents.id', '!=', $page->id)
|
||||
->get(),
|
||||
->where('contents.id', '!=', $page->id)
|
||||
->get(),
|
||||
'templates' => $templates,
|
||||
'extraData' => call_user_func([$page->module_handler, 'loadExtraData'], $page),
|
||||
'formSectionNames' => call_user_func([$page->module_handler, 'getExtendedFormSections']),
|
||||
@@ -223,14 +224,14 @@ class EditContent extends Controller
|
||||
|
||||
// change url to something unique
|
||||
$oldURL = $page->url;
|
||||
$page->url = uniqid($page->url.'_deleted');
|
||||
$page->url = uniqid($page->url . '_deleted');
|
||||
$page->save();
|
||||
|
||||
list ($revision, $changedColumns) = $page->updateWithHistory(['status' => 'status'], ['status' => Content::STATUS_DELETED]);
|
||||
|
||||
// let module to delete some extra content created during page's life
|
||||
call_user_func([$page->module_handler, 'delete'], $page);
|
||||
|
||||
|
||||
// was something changed?
|
||||
if ($changedColumns == 0) {
|
||||
return redirect()
|
||||
@@ -274,6 +275,7 @@ class EditContent extends Controller
|
||||
|
||||
// disable any other existing homepage
|
||||
Content::where('is_homepage', 1)
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->update(['is_homepage' => 0]);
|
||||
|
||||
// set new homepage
|
||||
|
||||
@@ -4,30 +4,39 @@ namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests;
|
||||
use App\Models\Settings as SettingsModel;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class Settings extends Controller
|
||||
{
|
||||
/**
|
||||
* @var \App\Models\Settings
|
||||
* @var SettingsModel
|
||||
*/
|
||||
protected $settings;
|
||||
|
||||
/**
|
||||
* Settings constructor.
|
||||
*
|
||||
* @param \App\Models\Settings $settings
|
||||
* @param SettingsModel $settings
|
||||
*/
|
||||
public function __construct(\App\Models\Settings $settings)
|
||||
public function __construct(SettingsModel $settings)
|
||||
{
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get overview (with form) for editing settings
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function getOverview()
|
||||
{
|
||||
$sections = App::make('registerSettingsExtension')
|
||||
->get();
|
||||
$settings = $this->settings->getAll();
|
||||
|
||||
// load all settings with language info
|
||||
$settings = $this->settings->getAllWithLanguage();
|
||||
|
||||
return view('admin.settings.overview', [
|
||||
'formSections' => $sections,
|
||||
@@ -35,35 +44,39 @@ class Settings extends Controller
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Save all settings (ignore empty ones)
|
||||
*
|
||||
* When settings used to be non-empty string and user deletes it, key is also deleted from database
|
||||
*
|
||||
* @param Requests\SaveSettingsRequest $request
|
||||
*
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function saveSettings(Requests\SaveSettingsRequest $request)
|
||||
{
|
||||
$data = $request->all();
|
||||
$commonSettings = isset($data['commonSettings']) ? $data['commonSettings'] : [];
|
||||
|
||||
// remove CSRF token field
|
||||
unset($data['_token']);
|
||||
unset($data['_token'], $data['commonSettings']);
|
||||
|
||||
$settings = $this->settings->getAll();
|
||||
$updated = 0;
|
||||
foreach ($data as $key => $value) {
|
||||
if (isset($settings->$key)) {
|
||||
if ($settings->$key != $value) {
|
||||
$updated++;
|
||||
\App\Models\Settings::where('key', $key)
|
||||
->update(['value' => $value]);
|
||||
}
|
||||
} else {
|
||||
\App\Models\Settings::create(['key' => $key, 'value' => $value]);
|
||||
$updated++;
|
||||
// select language for this setting key
|
||||
$language = isset($commonSettings[$key]) ? null : LaravelLocalization::getCurrentLocale();
|
||||
$setting = SettingsModel::firstOrNew(['language' => $language, 'key' => $key]);
|
||||
|
||||
if ($setting->value == $value) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// set value and save or delete
|
||||
$setting->value = $value;
|
||||
empty($value) ? $setting->delete() : $setting->save();
|
||||
}
|
||||
|
||||
if ($updated > 0) {
|
||||
return redirect()
|
||||
->route('settings.overview')
|
||||
->with('success', trans('admin/settings.successfullySaved'));
|
||||
} else {
|
||||
return redirect()
|
||||
->route('settings.overview')
|
||||
->with('error', trans('admin/settings.nothingToSave'));
|
||||
}
|
||||
return redirect()
|
||||
->route('settings.overview')
|
||||
->with('success', trans('admin/settings.successfullySaved'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,12 +2,14 @@
|
||||
namespace App\Http\Controllers\Admin;
|
||||
|
||||
use App\Models\Widget;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class WidgetsOverview extends Controller
|
||||
{
|
||||
public function getOverview()
|
||||
{
|
||||
$widgets = Widget::paginate(25);
|
||||
$widgets = Widget::where('language', LaravelLocalization::getCurrentLocale())
|
||||
->paginate(25);
|
||||
|
||||
return view('admin.widgets.overview', ['widgets' => $widgets]);
|
||||
}
|
||||
|
||||
+14
-7
@@ -3,6 +3,10 @@
|
||||
namespace App\Http;
|
||||
|
||||
use Illuminate\Foundation\Http\Kernel as HttpKernel;
|
||||
use Illuminate\Routing\Middleware\ThrottleRequests;
|
||||
use Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRedirectFilter;
|
||||
use Mcamara\LaravelLocalization\Middleware\LaravelLocalizationRoutes;
|
||||
use Mcamara\LaravelLocalization\Middleware\LocaleSessionRedirect;
|
||||
|
||||
class Kernel extends HttpKernel
|
||||
{
|
||||
@@ -23,11 +27,11 @@ class Kernel extends HttpKernel
|
||||
*/
|
||||
protected $middlewareGroups = [
|
||||
'web' => [
|
||||
\App\Http\Middleware\EncryptCookies::class,
|
||||
Middleware\EncryptCookies::class,
|
||||
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
|
||||
\Illuminate\Session\Middleware\StartSession::class,
|
||||
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
|
||||
\App\Http\Middleware\VerifyCsrfToken::class,
|
||||
Middleware\VerifyCsrfToken::class,
|
||||
],
|
||||
'api' => [
|
||||
'throttle:60,1',
|
||||
@@ -41,10 +45,13 @@ class Kernel extends HttpKernel
|
||||
* @var array
|
||||
*/
|
||||
protected $routeMiddleware = [
|
||||
'auth' => \App\Http\Middleware\Authenticate::class,
|
||||
'onlyAdmin' => \App\Http\Middleware\RequireAdminRole::class,
|
||||
'adminMenu' => \App\Http\Middleware\AdminMenuRegistrator::class,
|
||||
'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class,
|
||||
'auth' => Middleware\Authenticate::class,
|
||||
'onlyAdmin' => Middleware\RequireAdminRole::class,
|
||||
'adminMenu' => Middleware\AdminMenuRegistrator::class,
|
||||
'guest' => Middleware\RedirectIfAuthenticated::class,
|
||||
'throttle' => ThrottleRequests::class,
|
||||
'localize' => LaravelLocalizationRoutes::class,
|
||||
'localizationRedirect' => LaravelLocalizationRedirectFilter::class,
|
||||
'localeSessionRedirect' => LocaleSessionRedirect::class
|
||||
];
|
||||
}
|
||||
|
||||
+248
-241
@@ -4,274 +4,281 @@
|
||||
* This routing groups is used for routing along public part of website
|
||||
*/
|
||||
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
Route::pattern('id', '\d+');
|
||||
Route::pattern('url', '[0-9\-a-z]+');
|
||||
|
||||
/*******************************************************************************/
|
||||
|
||||
/**
|
||||
* This route group serves to handle request in admin
|
||||
*/
|
||||
Route::group([
|
||||
'middleware' => ['web', 'auth', 'adminMenu'],
|
||||
'namespace' => 'Admin',
|
||||
'prefix' => 'admin'
|
||||
'prefix' => LaravelLocalization::setLocale(),
|
||||
'middleware' => ['localeSessionRedirect', 'localizationRedirect']
|
||||
], function () {
|
||||
/**
|
||||
* This route group serves to handle request in admin
|
||||
*/
|
||||
Route::group([
|
||||
'middleware' => ['web', 'auth', 'adminMenu'],
|
||||
'namespace' => 'Admin',
|
||||
'prefix' => 'admin'
|
||||
], function () {
|
||||
|
||||
// these routes are available only for user with role admin
|
||||
Route::group(['middleware' => 'onlyAdmin'], function () {
|
||||
// display form for creating new user
|
||||
Route::get('users/new', 'CreateNewUser@getNewUser')
|
||||
->name('users.new');
|
||||
// these routes are available only for user with role admin
|
||||
Route::group(['middleware' => 'onlyAdmin'], function () {
|
||||
// display form for creating new user
|
||||
Route::get('users/new', 'CreateNewUser@getNewUser')
|
||||
->name('users.new');
|
||||
|
||||
// POST methods
|
||||
// display form for creating new user
|
||||
Route::post('users/new', 'CreateNewUser@postRegistration')
|
||||
->name('users.newPost');
|
||||
// POST methods
|
||||
// display form for creating new user
|
||||
Route::post('users/new', 'CreateNewUser@postRegistration')
|
||||
->name('users.newPost');
|
||||
|
||||
// display form for edit of existing user
|
||||
Route::get('users/edit/{id}', 'EditUser@getEditExistingUser')
|
||||
->name('users.edit');
|
||||
// display form for edit of existing user
|
||||
Route::get('users/edit/{id}', 'EditUser@getEditExistingUser')
|
||||
->name('users.edit');
|
||||
|
||||
// form for adding new custom field
|
||||
Route::get('customfields/new', 'CreateNewCustomField@getNew')
|
||||
->name('customfields.new');
|
||||
// form for adding new custom field
|
||||
Route::get('customfields/new', 'CreateNewCustomField@getNew')
|
||||
->name('customfields.new');
|
||||
|
||||
// form for editing custom field
|
||||
Route::get('customfields/edit/{id}', 'EditCustomField@getEditCustomField')
|
||||
->name('customfields.edit');
|
||||
// form for editing custom field
|
||||
Route::get('customfields/edit/{id}', 'EditCustomField@getEditCustomField')
|
||||
->name('customfields.edit');
|
||||
|
||||
// form for adding new custom field
|
||||
Route::post('customfields/new', 'CreateNewCustomField@postNew')
|
||||
->name('customfields.newPost');
|
||||
// form for adding new custom field
|
||||
Route::post('customfields/new', 'CreateNewCustomField@postNew')
|
||||
->name('customfields.newPost');
|
||||
|
||||
// form for editing custom field
|
||||
Route::post('customfields/edit/{id}', 'EditCustomField@postEditCustomField')
|
||||
->name('customfields.editPost');
|
||||
// form for editing custom field
|
||||
Route::post('customfields/edit/{id}', 'EditCustomField@postEditCustomField')
|
||||
->name('customfields.editPost');
|
||||
|
||||
Route::get('customfields/delete/{id}', 'EditCustomField@deleteCustomField')
|
||||
->name('customfields.delete');
|
||||
Route::get('customfields/delete/{id}', 'EditCustomField@deleteCustomField')
|
||||
->name('customfields.delete');
|
||||
|
||||
Route::get('templates/overview/path/{id}', 'TemplateOverview@getPath')
|
||||
->name('templates.overview');
|
||||
Route::get('templates/overview/path/{id}', 'TemplateOverview@getPath')
|
||||
->name('templates.overview');
|
||||
|
||||
Route::post('templates/copy', 'CopyTemplate@createCopy')
|
||||
->name('templates.postCopy');
|
||||
Route::post('templates/copy', 'CopyTemplate@createCopy')
|
||||
->name('templates.postCopy');
|
||||
|
||||
// Route::get('templates/new/{pathId}', 'TemplateOverview@getPath')
|
||||
// ->name('templates.new');
|
||||
// Route::get('templates/new/{pathId}', 'TemplateOverview@getPath')
|
||||
// ->name('templates.new');
|
||||
|
||||
Route::get('templates/edit/{id}', 'EditTemplate@getEdit')
|
||||
->name('templates.edit');
|
||||
Route::get('templates/edit/{id}', 'EditTemplate@getEdit')
|
||||
->name('templates.edit');
|
||||
|
||||
Route::post('templates/edit/{id}', 'EditTemplate@postEdit')
|
||||
->name('templates.postEdit');
|
||||
Route::post('templates/edit/{id}', 'EditTemplate@postEdit')
|
||||
->name('templates.postEdit');
|
||||
});
|
||||
|
||||
// list of all static pages
|
||||
Route::get('content/overview/{moduleId?}/{status?}', 'ContentOverview@getOverview')
|
||||
->name('content.overview');
|
||||
|
||||
// form for creating new static page
|
||||
Route::get('content/new/{moduleId}', 'CreateNewContent@getNew')
|
||||
->name('content.new');
|
||||
|
||||
// form for editing existing static page
|
||||
Route::get('content/edit/{id}', 'EditContent@getEdit')
|
||||
->name('content.edit');
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/new/{moduleId}', 'CreateNewContent@postNew')
|
||||
->name('content.newPost');
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/edit/{id}', 'EditContent@postEdit')
|
||||
->name('content.editPost');
|
||||
|
||||
// routes for quick actions
|
||||
|
||||
// change status of page (protected, public or draft)
|
||||
Route::get('content/status/{id}/{status}', 'EditContent@changeStatus')
|
||||
->name('content.changeStatus');
|
||||
|
||||
// set homepage
|
||||
Route::get('content/homepage/{id}', 'EditContent@setHomepage')
|
||||
->name('content.setHomepage');
|
||||
|
||||
// delete page
|
||||
Route::get('content/delete/{id}', 'EditContent@deletePage')
|
||||
->name('content.delete');
|
||||
|
||||
// these routes are available for all logged (authenticated) users
|
||||
|
||||
// display dashboard with some usefull information
|
||||
Route::get('/', 'Dashboard@getIndex')
|
||||
->name('admin.dashboard');
|
||||
|
||||
// display user detail in admin
|
||||
Route::get('users/detail/{id?}', 'UserDetail@getDetail')
|
||||
->name('users.detail');
|
||||
|
||||
// method for saving edited data of user
|
||||
Route::post('users/edit/{id}', 'EditUser@postEdit')
|
||||
->name('users.editPost');
|
||||
|
||||
// display list of all users registered into our system
|
||||
Route::get('users/overview/{state?}/{perPage?}', 'UsersOverview@getOverview')
|
||||
->name('users.overview');
|
||||
|
||||
// history of changes for specified page
|
||||
Route::get('history/{id}', 'History@getOverview')
|
||||
->name('content.history');
|
||||
|
||||
// history of changes for specified page
|
||||
Route::get('history/{revision}/{id}', 'History@getDiff')
|
||||
->name('history.diff');
|
||||
|
||||
// list of all actions
|
||||
Route::get('actions', 'ActionLogOverview@getOverview')
|
||||
->name('log.overview');
|
||||
|
||||
// routes for widget areas
|
||||
Route::get('widgets/areas/overview', 'WidgetAreaOverview@getOverview')
|
||||
->name('widgetareas.overview');
|
||||
|
||||
// form for new widget area
|
||||
Route::get('widgets/areas/new', 'CreateNewWidgetArea@getNew')
|
||||
->name('widgetareas.new');
|
||||
|
||||
// form for new widget area
|
||||
Route::post('widgets/areas/new', 'CreateNewWidgetArea@postNew')
|
||||
->name('widgetareas.postNew');
|
||||
|
||||
// edit form for widget area
|
||||
Route::get('widgets/areas/edit/{id}', 'EditWidgetArea@getEdit')
|
||||
->name('widgetareas.edit');
|
||||
|
||||
Route::post('widgets/areas/edit/{id}', 'EditWidgetArea@postEdit')
|
||||
->name('widgetareas.postEdit');
|
||||
|
||||
// edit form for widget area
|
||||
Route::get('widgets/areas/delete/{id}', 'EditWidgetArea@deleteArea')
|
||||
->name('widgetareas.delete');
|
||||
|
||||
// list of all installed widget types
|
||||
Route::get('widgets/overview', 'WidgetsOverview@getOverview')
|
||||
->name('widgets.overview');
|
||||
|
||||
// create new instance of widget of given type
|
||||
Route::get('widgets/new/{type}', 'CreateNewWidget@getNew')
|
||||
->name('widgets.new');
|
||||
|
||||
Route::post('widgets/new/{type}', 'CreateNewWidget@postNew')
|
||||
->name('widgets.postNew');
|
||||
|
||||
// edit widget settings
|
||||
Route::get('widgets/edit/{id}', 'EditWidget@getEdit')
|
||||
->name('widgets.edit');
|
||||
|
||||
Route::post('widgets/edit/{id}', 'EditWidget@postEdit')
|
||||
->name('widgets.postEdit');
|
||||
|
||||
// display form for association of widget and widget area
|
||||
Route::get('widgets/associate/{widgetArea}', 'AssociateWidget@getList')
|
||||
->name('widgets.associate');
|
||||
|
||||
Route::get('widgets/deassociate/{widgetId}/{widgetArea}', 'AssociateWidget@deleteAssociation')
|
||||
->name('widgets.deleteAssociation');
|
||||
|
||||
Route::get('widgets/associate/{widgetId}/{widgetArea}', 'AssociateWidget@makeAssociation')
|
||||
->name('widgets.makeAssociation');
|
||||
|
||||
// uploader methods
|
||||
Route::get('directories/new/{id?}', 'CreateNewDirectory@getNew')
|
||||
->name('upload.newDirectory');
|
||||
|
||||
Route::get('directories/edit/{id}', 'EditDirectory@getEdit')
|
||||
->name('upload.editDirectory');
|
||||
|
||||
Route::post('directories/edit/{id}', 'EditDirectory@postEdit')
|
||||
->name('upload.postEditDirectory');
|
||||
|
||||
Route::get('files/overview/{id?}/{type?}/{subtype?}', 'UploadedFilesOverview@getOverview')
|
||||
->name('upload.overview');
|
||||
|
||||
route::post('directories/new', 'CreateNewDirectory@postNew')
|
||||
->name('upload.postNewDirectory');
|
||||
|
||||
Route::get('upload/detail/{id}', 'EditUploadedFile@getDetail')
|
||||
->name('upload.detail');
|
||||
|
||||
Route::post('upload/detail/{id}', 'EditUploadedFile@postEdit')
|
||||
->name('upload.postEdit');
|
||||
|
||||
Route::get('upload/delete/{id}', 'EditUploadedFile@deleteFile')
|
||||
->name('upload.delete');
|
||||
|
||||
// uploader methods
|
||||
Route::post('upload/file', 'UploadFile@postFile')
|
||||
->name('upload.postFile');
|
||||
|
||||
Route::post('upload/image', 'UploadFile@postImage')
|
||||
->name('upload.postImage');
|
||||
|
||||
// form with settings
|
||||
Route::get('settings', 'Settings@getOverview')
|
||||
->name('settings.overview');
|
||||
|
||||
Route::post('settings', 'Settings@saveSettings')
|
||||
->name('settings.save');
|
||||
|
||||
Route::get('search', 'Search@getSearch')
|
||||
->name('search');
|
||||
|
||||
// custom fields
|
||||
// ------------------------------
|
||||
|
||||
// list of all custom fields
|
||||
Route::get('customfields/overview', 'CustomFieldsOverview@getOverview')
|
||||
->name('customfields.overview');
|
||||
|
||||
// logout method
|
||||
Route::get('logout', function () {
|
||||
|
||||
// remove user information
|
||||
\Auth::logout();
|
||||
|
||||
// redirect to login form with info about successfull logout
|
||||
return redirect()
|
||||
->route('login')
|
||||
->with('success', trans('admin/common.logoutSuccessfull'));
|
||||
})
|
||||
->name('logout');
|
||||
});
|
||||
|
||||
// list of all static pages
|
||||
Route::get('content/overview/{moduleId?}/{status?}', 'ContentOverview@getOverview')
|
||||
->name('content.overview');
|
||||
/**************************************************************************************/
|
||||
|
||||
// form for creating new static page
|
||||
Route::get('content/new/{moduleId}', 'CreateNewContent@getNew')
|
||||
->name('content.new');
|
||||
/**
|
||||
* This section must be specified as last one
|
||||
*/
|
||||
|
||||
// form for editing existing static page
|
||||
Route::get('content/edit/{id}', 'EditContent@getEdit')
|
||||
->name('content.edit');
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/new/{moduleId}', 'CreateNewContent@postNew')
|
||||
->name('content.newPost');
|
||||
Route::get('/', 'Visitor\Homepage@getIndex')
|
||||
->name('page.index');
|
||||
|
||||
// post method for creating new static page
|
||||
Route::post('content/edit/{id}', 'EditContent@postEdit')
|
||||
->name('content.editPost');
|
||||
// display login form
|
||||
Route::get('admin/login', function () {
|
||||
return view('admin.loginForm.form');
|
||||
})
|
||||
->name('loginForm');
|
||||
|
||||
// routes for quick actions
|
||||
// handle login
|
||||
Route::post('admin/login', 'Admin\Login@postLogin')
|
||||
->name('login');
|
||||
|
||||
// change status of page (protected, public or draft)
|
||||
Route::get('content/status/{id}/{status}', 'EditContent@changeStatus')
|
||||
->name('content.changeStatus');
|
||||
// route for sitemap
|
||||
Route::get('sitemap.xml', 'Sitemap@getMap')
|
||||
->name('sitemap');
|
||||
|
||||
// set homepage
|
||||
Route::get('content/homepage/{id}', 'EditContent@setHomepage')
|
||||
->name('content.setHomepage');
|
||||
|
||||
// delete page
|
||||
Route::get('content/delete/{id}', 'EditContent@deletePage')
|
||||
->name('content.delete');
|
||||
|
||||
// these routes are available for all logged (authenticated) users
|
||||
|
||||
// display dashboard with some usefull information
|
||||
Route::get('/', 'Dashboard@getIndex')
|
||||
->name('admin.dashboard');
|
||||
|
||||
// display user detail in admin
|
||||
Route::get('users/detail/{id?}', 'UserDetail@getDetail')
|
||||
->name('users.detail');
|
||||
|
||||
// method for saving edited data of user
|
||||
Route::post('users/edit/{id}', 'EditUser@postEdit')
|
||||
->name('users.editPost');
|
||||
|
||||
// display list of all users registered into our system
|
||||
Route::get('users/overview/{state?}/{perPage?}', 'UsersOverview@getOverview')
|
||||
->name('users.overview');
|
||||
|
||||
// history of changes for specified page
|
||||
Route::get('history/{id}', 'History@getOverview')
|
||||
->name('content.history');
|
||||
|
||||
// history of changes for specified page
|
||||
Route::get('history/{revision}/{id}', 'History@getDiff')
|
||||
->name('history.diff');
|
||||
|
||||
// list of all actions
|
||||
Route::get('actions', 'ActionLogOverview@getOverview')
|
||||
->name('log.overview');
|
||||
|
||||
// routes for widget areas
|
||||
Route::get('widgets/areas/overview', 'WidgetAreaOverview@getOverview')
|
||||
->name('widgetareas.overview');
|
||||
|
||||
// form for new widget area
|
||||
Route::get('widgets/areas/new', 'CreateNewWidgetArea@getNew')
|
||||
->name('widgetareas.new');
|
||||
|
||||
// form for new widget area
|
||||
Route::post('widgets/areas/new', 'CreateNewWidgetArea@postNew')
|
||||
->name('widgetareas.postNew');
|
||||
|
||||
// edit form for widget area
|
||||
Route::get('widgets/areas/edit/{id}', 'EditWidgetArea@getEdit')
|
||||
->name('widgetareas.edit');
|
||||
|
||||
Route::post('widgets/areas/edit/{id}', 'EditWidgetArea@postEdit')
|
||||
->name('widgetareas.postEdit');
|
||||
|
||||
// edit form for widget area
|
||||
Route::get('widgets/areas/delete/{id}', 'EditWidgetArea@deleteArea')
|
||||
->name('widgetareas.delete');
|
||||
|
||||
// list of all installed widget types
|
||||
Route::get('widgets/overview', 'WidgetsOverview@getOverview')
|
||||
->name('widgets.overview');
|
||||
|
||||
// create new instance of widget of given type
|
||||
Route::get('widgets/new/{type}', 'CreateNewWidget@getNew')
|
||||
->name('widgets.new');
|
||||
|
||||
Route::post('widgets/new/{type}', 'CreateNewWidget@postNew')
|
||||
->name('widgets.postNew');
|
||||
|
||||
// edit widget settings
|
||||
Route::get('widgets/edit/{id}', 'EditWidget@getEdit')
|
||||
->name('widgets.edit');
|
||||
|
||||
Route::post('widgets/edit/{id}', 'EditWidget@postEdit')
|
||||
->name('widgets.postEdit');
|
||||
|
||||
// display form for association of widget and widget area
|
||||
Route::get('widgets/associate/{widgetArea}', 'AssociateWidget@getList')
|
||||
->name('widgets.associate');
|
||||
|
||||
Route::get('widgets/deassociate/{widgetId}/{widgetArea}', 'AssociateWidget@deleteAssociation')
|
||||
->name('widgets.deleteAssociation');
|
||||
|
||||
Route::get('widgets/associate/{widgetId}/{widgetArea}', 'AssociateWidget@makeAssociation')
|
||||
->name('widgets.makeAssociation');
|
||||
|
||||
// uploader methods
|
||||
Route::get('directories/new/{id?}', 'CreateNewDirectory@getNew')
|
||||
->name('upload.newDirectory');
|
||||
|
||||
Route::get('directories/edit/{id}', 'EditDirectory@getEdit')
|
||||
->name('upload.editDirectory');
|
||||
|
||||
Route::post('directories/edit/{id}', 'EditDirectory@postEdit')
|
||||
->name('upload.postEditDirectory');
|
||||
|
||||
Route::get('files/overview/{id?}/{type?}/{subtype?}', 'UploadedFilesOverview@getOverview')
|
||||
->name('upload.overview');
|
||||
|
||||
route::post('directories/new', 'CreateNewDirectory@postNew')
|
||||
->name('upload.postNewDirectory');
|
||||
|
||||
Route::get('upload/detail/{id}', 'EditUploadedFile@getDetail')
|
||||
->name('upload.detail');
|
||||
|
||||
Route::post('upload/detail/{id}', 'EditUploadedFile@postEdit')
|
||||
->name('upload.postEdit');
|
||||
|
||||
Route::get('upload/delete/{id}', 'EditUploadedFile@deleteFile')
|
||||
->name('upload.delete');
|
||||
|
||||
// uploader methods
|
||||
Route::post('upload/file', 'UploadFile@postFile')
|
||||
->name('upload.postFile');
|
||||
|
||||
Route::post('upload/image', 'UploadFile@postImage')
|
||||
->name('upload.postImage');
|
||||
|
||||
// form with settings
|
||||
Route::get('settings', 'Settings@getOverview')
|
||||
->name('settings.overview');
|
||||
|
||||
Route::post('settings', 'Settings@saveSettings')
|
||||
->name('settings.save');
|
||||
|
||||
Route::get('search', 'Search@getSearch')
|
||||
->name('search');
|
||||
|
||||
// custom fields
|
||||
// ------------------------------
|
||||
|
||||
// list of all custom fields
|
||||
Route::get('customfields/overview', 'CustomFieldsOverview@getOverview')
|
||||
->name('customfields.overview');
|
||||
|
||||
// logout method
|
||||
Route::get('logout', function () {
|
||||
|
||||
// remove user information
|
||||
\Auth::logout();
|
||||
|
||||
// redirect to login form with info about successfull logout
|
||||
return redirect()
|
||||
->route('login')
|
||||
->with('success', trans('admin/common.logoutSuccessfull'));
|
||||
})
|
||||
->name('logout');
|
||||
});
|
||||
|
||||
/**************************************************************************************/
|
||||
|
||||
/**
|
||||
* This section must be specified as last one
|
||||
*/
|
||||
|
||||
Route::group(['middleware' => ['web']], function () {
|
||||
|
||||
Route::get('/', 'Visitor\Homepage@getIndex')
|
||||
->name('page.index');
|
||||
|
||||
// display login form
|
||||
Route::get('admin/login', function () {
|
||||
return view('admin.loginForm.form');
|
||||
})
|
||||
->name('loginForm');
|
||||
|
||||
// handle login
|
||||
Route::post('admin/login', 'Admin\Login@postLogin')
|
||||
->name('login');
|
||||
|
||||
// route for sitemap
|
||||
Route::get('sitemap.xml', 'Sitemap@getMap')
|
||||
->name('sitemap');
|
||||
|
||||
// route for all content pages. This rule must be specified last (because it matches every route)
|
||||
Route::get('{url}', 'Visitor\ContentPage@getPage')
|
||||
->name('page.content');
|
||||
// route for all content pages. This rule must be specified last (because it matches every route)
|
||||
Route::get('{url}', 'Visitor\ContentPage@getPage')
|
||||
->name('page.content');
|
||||
});
|
||||
});
|
||||
@@ -5,6 +5,7 @@ namespace App\Models;
|
||||
use App\Enumerations\ContentStatuses;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
/**
|
||||
* Class Content
|
||||
@@ -15,6 +16,7 @@ class Content extends Model
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
'parent_id',
|
||||
'language',
|
||||
'module_handler',
|
||||
'published_from',
|
||||
'published_to',
|
||||
@@ -53,6 +55,7 @@ class Content extends Model
|
||||
public function getHomepage()
|
||||
{
|
||||
return $this->getPageQuery()
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->where('is_homepage', 1)
|
||||
->first();
|
||||
}
|
||||
@@ -68,6 +71,7 @@ class Content extends Model
|
||||
{
|
||||
return $this->getPageQuery()
|
||||
->where('url', $url)
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->first();
|
||||
}
|
||||
|
||||
@@ -81,6 +85,7 @@ class Content extends Model
|
||||
if (!$this->subpagesInit) {
|
||||
$this->subpages = $this->getPageQuery()
|
||||
->where('parent_id', $this->id)
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->get();
|
||||
|
||||
// convert JSON settings into stdClass
|
||||
@@ -142,6 +147,7 @@ class Content extends Model
|
||||
public function rootPages()
|
||||
{
|
||||
$rootPages = $this->getPageQuery()
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->where('parent_id', null);
|
||||
|
||||
if ($this->id) {
|
||||
@@ -166,6 +172,7 @@ class Content extends Model
|
||||
$query = DB::table('contents')
|
||||
->select('contents.*', 'modules.name AS module_name')
|
||||
->where('contents.status', '<>', self::STATUS_DELETED)
|
||||
->where('contents.language', LaravelLocalization::getCurrentLocale())
|
||||
->join('modules', 'modules.handler', '=', 'contents.module_handler')
|
||||
->orderBy('created_at', 'DESC');
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Language extends Model
|
||||
{
|
||||
public $timestamps = false;
|
||||
public $primaryKey = 'code';
|
||||
protected $fillable = [
|
||||
'code',
|
||||
'name',
|
||||
'script',
|
||||
'native'
|
||||
];
|
||||
protected $guarded = [];
|
||||
}
|
||||
+41
-6
@@ -3,12 +3,26 @@
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class Settings extends Model
|
||||
{
|
||||
protected $table = 'settings';
|
||||
public $timestamps = false;
|
||||
protected $fillable = ['key', 'value'];
|
||||
protected $fillable = ['key', 'value', 'language'];
|
||||
|
||||
/**
|
||||
* Prepares common query for selecting settings
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
protected function getSettingsQuery()
|
||||
{
|
||||
return Settings::select(['key', 'value', 'language'])
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->orWhere('language', null)
|
||||
->orderBy('language', 'DESC');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load all settings
|
||||
@@ -17,12 +31,33 @@ class Settings extends Model
|
||||
*/
|
||||
public function getAll()
|
||||
{
|
||||
$settings = Settings::select(['key', 'value'])
|
||||
->get();
|
||||
$settings = $this->getSettingsQuery()
|
||||
->get();
|
||||
|
||||
return $this->returnPairs($settings);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all settings with language info
|
||||
*
|
||||
* @return \stdClass
|
||||
*/
|
||||
public function getAllWithLanguage()
|
||||
{
|
||||
$settings = $this->getSettingsQuery()
|
||||
->get();
|
||||
|
||||
$data = new \stdClass();
|
||||
foreach ($settings as $conf) {
|
||||
$data->{$conf->key} = [
|
||||
'val' => $conf->value,
|
||||
'lang' => $conf->language
|
||||
];
|
||||
}
|
||||
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load only config for views
|
||||
*
|
||||
@@ -30,9 +65,9 @@ class Settings extends Model
|
||||
*/
|
||||
public function getForView()
|
||||
{
|
||||
$settings = Settings::select(['key', 'value'])
|
||||
->where('load_into_views', 1)
|
||||
->get();
|
||||
$settings = $this->getSettingsQuery()
|
||||
->where('load_into_views', 1)
|
||||
->get();
|
||||
|
||||
return $this->returnPairs($settings);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\Event;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
/**
|
||||
* Class Widget
|
||||
@@ -39,6 +40,7 @@ class Widget extends Model
|
||||
// create new widget
|
||||
$widget = new Widget();
|
||||
$widget->widget_type_handler = $widgetType->handler;
|
||||
$widget->language = LaravelLocalization::getCurrentLocale();
|
||||
$widget->user_id = \Auth::user()->id;
|
||||
$widget->name = $data->name;
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
/**
|
||||
* Class WidgetArea
|
||||
@@ -25,6 +26,7 @@ class WidgetArea extends Model
|
||||
->where('code', $uniqueCode)
|
||||
->join('widget_in_widget_area', 'widget_in_widget_area.widget_area_id', '=', 'widget_areas.id')
|
||||
->join('widgets', 'widget_in_widget_area.widget_id', '=', 'widgets.id')
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->orderBy('widget_in_widget_area.position');
|
||||
}
|
||||
}
|
||||
@@ -67,6 +67,7 @@ class AppServiceProvider extends ServiceProvider
|
||||
// register PingPong module extension
|
||||
$this->app->register('Pingpong\Modules\ModulesServiceProvider');
|
||||
$this->app->register('Pingpong\Menus\MenusServiceProvider');
|
||||
$this->app->register(LaravelLocalizationServiceProvider::class);
|
||||
|
||||
// create singletons for registering widgets
|
||||
$this->app->singleton('registerWidget', function ($app) {
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php namespace App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
use Symfony\Component\Translation\Translator;
|
||||
|
||||
class LaravelLocalizationServiceProvider extends ServiceProvider
|
||||
{
|
||||
public function register()
|
||||
{
|
||||
|
||||
$languages = DB::table('languages')
|
||||
->get();
|
||||
|
||||
$supportedLocales = [
|
||||
config('app.locale') => [
|
||||
'native' => env('LOCALE_NATIVE_NAME'),
|
||||
'script' => env('LOCALE_SCRIPT'),
|
||||
'name' => env('LOCALE_TRANSLATED_NAME'),
|
||||
]
|
||||
];
|
||||
foreach ($languages as $language) {
|
||||
$supportedLocales[$language->code] = [
|
||||
'native' => $language->native,
|
||||
'name' => $language->name,
|
||||
'script' => $language->script
|
||||
];
|
||||
}
|
||||
|
||||
config([
|
||||
'laravellocalization.supportedLocales' => $supportedLocales,
|
||||
'laravellocalization.useAcceptLanguageHeader' => true,
|
||||
'laravellocalization.hideDefaultLocaleInURL' => true
|
||||
]);
|
||||
}
|
||||
|
||||
public function boot()
|
||||
{
|
||||
\App::setLocale(LaravelLocalization::getCurrentLocale());
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
namespace App\Widgets\Menu;
|
||||
|
||||
use App\Http\Requests\Request;
|
||||
use App\Models\Content;
|
||||
use App\Widgets\Contracts\WidgetRenderer;
|
||||
use App\Widgets\Exceptions\MissingParameterException;
|
||||
use App\Widgets\NonInstallableWidget;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class Menu extends NonInstallableWidget
|
||||
{
|
||||
@@ -40,7 +41,7 @@ class Menu extends NonInstallableWidget
|
||||
|
||||
/**
|
||||
* @param \App\Models\Widget $widget
|
||||
* @param \stdClass $data
|
||||
* @param \stdClass $data
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
@@ -50,13 +51,36 @@ class Menu extends NonInstallableWidget
|
||||
throw new MissingParameterException('settings');
|
||||
}
|
||||
|
||||
$links = json_decode($data->settings);
|
||||
$pages = self::selectContentPages(array_keys((array)$links));
|
||||
|
||||
foreach ($links as $link) {
|
||||
if (!isset($pages[$link->id])) {
|
||||
unset($links->{$link->id});
|
||||
}
|
||||
}
|
||||
|
||||
$settings = [
|
||||
'links' => json_decode($data->settings),
|
||||
'links' => $links,
|
||||
'containerClass' => $data->containerClass
|
||||
];
|
||||
|
||||
|
||||
$widget->settings = json_encode($settings);
|
||||
|
||||
return $widget;
|
||||
}
|
||||
|
||||
public static function selectContentPages($ids)
|
||||
{
|
||||
$pages = Content::where('status', '!=', Content::STATUS_DELETED)
|
||||
->where('language', LaravelLocalization::getCurrentLocale())
|
||||
->whereIn('id', $ids)
|
||||
->get();
|
||||
$used = [];
|
||||
foreach ($pages as $page) {
|
||||
$used[$page->id] = $page;
|
||||
}
|
||||
|
||||
return $used;
|
||||
}
|
||||
}
|
||||
@@ -8,23 +8,10 @@ use App\Widgets\Contracts\WidgetRenderer;
|
||||
use Illuminate\Support\Facades\App;
|
||||
use Illuminate\Support\Facades\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Mcamara\LaravelLocalization\Facades\LaravelLocalization;
|
||||
|
||||
class Menu implements WidgetRenderer
|
||||
{
|
||||
protected static function selectContentPages($ids)
|
||||
{
|
||||
$pages = Content::where('status', '!=', Content::STATUS_DELETED)
|
||||
->whereIn('id', $ids)
|
||||
->get();
|
||||
$used = [];
|
||||
|
||||
foreach ($pages as $page) {
|
||||
$used[$page->id] = $page;
|
||||
}
|
||||
|
||||
return $used;
|
||||
}
|
||||
|
||||
/**
|
||||
* Method used for displaying widget.
|
||||
*
|
||||
@@ -41,7 +28,7 @@ class Menu implements WidgetRenderer
|
||||
$pageIds = array_keys($links);
|
||||
|
||||
// get pages
|
||||
$pages = self::selectContentPages($pageIds);
|
||||
$pages = \App\Widgets\Menu\Menu::selectContentPages($pageIds);
|
||||
|
||||
// sort links using "order"
|
||||
uasort($links, function ($a, $b) {
|
||||
|
||||
Reference in New Issue
Block a user