FEATURE: use more route model binding
This commit is contained in:
@@ -27,12 +27,12 @@ class WidgetAreas
|
|||||||
|
|
||||||
protected static function loadWidgetArea($uniqueCode)
|
protected static function loadWidgetArea($uniqueCode)
|
||||||
{
|
{
|
||||||
dd($uniqueCode);
|
|
||||||
WidgetArea::where('code', $uniqueCode)
|
WidgetArea::where('code', $uniqueCode)
|
||||||
->increment('viewed');
|
->increment('viewed');
|
||||||
|
|
||||||
$widgets = Cache::remember('widget-area-' . $uniqueCode, setting('widgetCacheLifetime', 5), function () use ($uniqueCode) {
|
$widgets = Cache::remember('widget-area-' . $uniqueCode, setting('widgetCacheLifetime', 5), function () use ($uniqueCode) {
|
||||||
$widgetArea = new WidgetArea();
|
$widgetArea = app(\App\CMS\Repositories\Widgets\WidgetArea::class);
|
||||||
|
|
||||||
return $widgetArea->getWidgets($uniqueCode)
|
return $widgetArea->getWidgets($uniqueCode)
|
||||||
->get();
|
->get();
|
||||||
});
|
});
|
||||||
@@ -69,6 +69,8 @@ class WidgetAreas
|
|||||||
self::initWidgetAreas();
|
self::initWidgetAreas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// dd($uniqueCode);
|
||||||
|
|
||||||
if (!isset(self::$widgetAreas[$uniqueCode])) {
|
if (!isset(self::$widgetAreas[$uniqueCode])) {
|
||||||
self::loadWidgetArea($uniqueCode);
|
self::loadWidgetArea($uniqueCode);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ use App\CMS\Interactions\Admin\Content\ChangeStatus;
|
|||||||
use App\CMS\Interactions\Admin\Content\DeletePage;
|
use App\CMS\Interactions\Admin\Content\DeletePage;
|
||||||
use App\CMS\Interactions\Admin\Content\SetHomepage;
|
use App\CMS\Interactions\Admin\Content\SetHomepage;
|
||||||
use App\Http\Controllers\Admin\Controller;
|
use App\Http\Controllers\Admin\Controller;
|
||||||
|
use App\Models\Content\Content;
|
||||||
|
use App\Models\Content\ContentHistory;
|
||||||
|
|
||||||
class ContentActions extends Controller
|
class ContentActions extends Controller
|
||||||
{
|
{
|
||||||
@@ -25,15 +27,13 @@ class ContentActions extends Controller
|
|||||||
* This method is called in static page overview from quick actions. It checks if status is valid, if page exists
|
* This method is called in static page overview from quick actions. It checks if status is valid, if page exists
|
||||||
* and updates status.
|
* and updates status.
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param Content $page
|
||||||
* @param $status
|
* @param $status
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function changeStatus($id, $status)
|
public function changeStatus(Content $page, $status)
|
||||||
{
|
{
|
||||||
$page = $this->content->getOne($id);
|
|
||||||
|
|
||||||
Interaction::handle(ChangeStatus::class, ['status' => $status], $page);
|
Interaction::handle(ChangeStatus::class, ['status' => $status], $page);
|
||||||
|
|
||||||
// redirect back to overview with info for user
|
// redirect back to overview with info for user
|
||||||
@@ -45,14 +45,12 @@ class ContentActions extends Controller
|
|||||||
/**
|
/**
|
||||||
* Delete page
|
* Delete page
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param Content $page
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function delete($id)
|
public function delete(Content $page)
|
||||||
{
|
{
|
||||||
$page = $this->content->getOne($id);
|
|
||||||
|
|
||||||
Interaction::handle(DeletePage::class, [], $page);
|
Interaction::handle(DeletePage::class, [], $page);
|
||||||
|
|
||||||
// redirect back to overview with info for user
|
// redirect back to overview with info for user
|
||||||
@@ -66,14 +64,12 @@ class ContentActions extends Controller
|
|||||||
/**
|
/**
|
||||||
* Sets page as homepage
|
* Sets page as homepage
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param Content $page
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
*/
|
*/
|
||||||
public function setHomepage($id)
|
public function setHomepage(Content $page)
|
||||||
{
|
{
|
||||||
$page = $this->content->getOne($id);
|
|
||||||
|
|
||||||
Interaction::handle(SetHomepage::class, [], $page);
|
Interaction::handle(SetHomepage::class, [], $page);
|
||||||
|
|
||||||
// redirect back to overview with info for user
|
// redirect back to overview with info for user
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use App\CMS\Contracts\Repositories\Content as IContent;
|
|||||||
use App\CMS\Contracts\Repositories\Module as IModule;
|
use App\CMS\Contracts\Repositories\Module as IModule;
|
||||||
use App\CMS\Enumerations\ContentStatuses;
|
use App\CMS\Enumerations\ContentStatuses;
|
||||||
use App\Http\Controllers\Admin\Controller;
|
use App\Http\Controllers\Admin\Controller;
|
||||||
|
use App\Models\Module;
|
||||||
|
|
||||||
class ContentOverview extends Controller
|
class ContentOverview extends Controller
|
||||||
{
|
{
|
||||||
@@ -26,19 +27,19 @@ class ContentOverview extends Controller
|
|||||||
/**
|
/**
|
||||||
* Overview for all content pages.
|
* Overview for all content pages.
|
||||||
*
|
*
|
||||||
* @param null|int $moduleId
|
* @param Module|null $module
|
||||||
* @param null $status
|
* @param null $status
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
* @internal param int|null $moduleId
|
||||||
*/
|
*/
|
||||||
public function index($moduleId = null, $status = null)
|
public function index(Module $module = null, $status = null)
|
||||||
{
|
{
|
||||||
// get module settings
|
// get module settings
|
||||||
$module = $this->module->getOne($moduleId);
|
|
||||||
$pageHeading = $this->module->getOverviewTitle($module);
|
$pageHeading = $this->module->getOverviewTitle($module);
|
||||||
|
|
||||||
// get pages for overview
|
// get pages for overview
|
||||||
$handler = $module !== null ? $module->handler : null;
|
$handler = $module->exists ? $module->handler : null;
|
||||||
$pages = $this->content->getOverview($handler, [$status])
|
$pages = $this->content->getOverview($handler, [$status])
|
||||||
->paginate(setting('paginatedResults', 20));
|
->paginate(setting('paginatedResults', 20));
|
||||||
|
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ use App\Cms\Interactions\Admin\Content\NewContent;
|
|||||||
use App\Http\Controllers\Admin\Controller;
|
use App\Http\Controllers\Admin\Controller;
|
||||||
use App\Http\Requests\CreateNewContentRequest;
|
use App\Http\Requests\CreateNewContentRequest;
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
|
use App\Models\Module;
|
||||||
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
use Modules\Categories\Contracts\Repositories\Category as ICategory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -67,9 +68,8 @@ class CreateNewContent extends Controller
|
|||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function create($module)
|
public function create(Module $module)
|
||||||
{
|
{
|
||||||
$module = $this->module->getOne($module);
|
|
||||||
$statuses = ContentStatuses::getWithTranslations();
|
$statuses = ContentStatuses::getWithTranslations();
|
||||||
$pageHeading = $this->module->getCreateContentTitle($module);
|
$pageHeading = $this->module->getCreateContentTitle($module);
|
||||||
$templates = $this->template->getForModule($module);
|
$templates = $this->template->getForModule($module);
|
||||||
@@ -95,15 +95,14 @@ class CreateNewContent extends Controller
|
|||||||
/**
|
/**
|
||||||
* Save new content page
|
* Save new content page
|
||||||
*
|
*
|
||||||
* @param CreateNewContentRequest $request
|
* @param CreateNewContentRequest|Request $request
|
||||||
* @param $moduleId
|
* @param Module $module
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
* @internal param $moduleId
|
||||||
*/
|
*/
|
||||||
public function store(Request $request, $moduleId)
|
public function store(Request $request, Module $module)
|
||||||
{
|
{
|
||||||
$module = $this->module->getOne($moduleId);
|
|
||||||
|
|
||||||
// create new page
|
// create new page
|
||||||
Interaction::handle(NewContent::class, $request->all(), $module->handler);
|
Interaction::handle(NewContent::class, $request->all(), $module->handler);
|
||||||
|
|
||||||
|
|||||||
@@ -72,14 +72,13 @@ class EditContent extends Controller
|
|||||||
/**
|
/**
|
||||||
* Display form for editing static page
|
* Display form for editing static page
|
||||||
*
|
*
|
||||||
* @param $id
|
* @param Content $page
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function edit($id)
|
public function edit(Content $page)
|
||||||
{
|
{
|
||||||
$statuses = ContentStatuses::getWithTranslations();
|
$statuses = ContentStatuses::getWithTranslations();
|
||||||
$page = $this->content->getOne($id);
|
|
||||||
|
|
||||||
// get module ID
|
// get module ID
|
||||||
$module = $this->module->getByHandler($page->moduleHandler);
|
$module = $this->module->getByHandler($page->moduleHandler);
|
||||||
@@ -106,29 +105,14 @@ class EditContent extends Controller
|
|||||||
/**
|
/**
|
||||||
* Edit static page and save changes into history.
|
* Edit static page and save changes into history.
|
||||||
*
|
*
|
||||||
* @param EditContentRequest $request
|
* @param EditContentRequest|Request $request
|
||||||
* @param $id
|
* @param Content $page
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
* @return \Illuminate\Http\RedirectResponse
|
||||||
|
* @internal param $id
|
||||||
*/
|
*/
|
||||||
public function update(Request $request, $id)
|
public function update(Request $request, Content $page)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
/**
|
|
||||||
* @var $page Content
|
|
||||||
*/
|
|
||||||
$page = $this->content->getOne($id);
|
|
||||||
} catch (NotFoundHttpException $e) {
|
|
||||||
|
|
||||||
// log attempt of invalid edit
|
|
||||||
Event::fire(new AttemptToEditInvalidContent($id));
|
|
||||||
|
|
||||||
// page for editing not found
|
|
||||||
return redirect()
|
|
||||||
->route('content.overview')
|
|
||||||
->with('error', trans('admin/contents.invalidPage'));
|
|
||||||
}
|
|
||||||
|
|
||||||
// edit page
|
// edit page
|
||||||
Interaction::handle(EditContentInteraction::class, $request->all(), $page);
|
Interaction::handle(EditContentInteraction::class, $request->all(), $page);
|
||||||
|
|
||||||
|
|||||||
@@ -19,30 +19,31 @@ class History extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $id
|
* @param Content $page
|
||||||
*
|
*
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function getOverview($id)
|
public function getOverview(Content $page)
|
||||||
{
|
{
|
||||||
// test if given content id is static page and if exists
|
$history = $this->history->getStructuredHistoryOf($page);
|
||||||
$content = Content::findOrFail($id);
|
|
||||||
|
|
||||||
$history = $this->history->getStructuredHistoryOf($content);
|
|
||||||
|
|
||||||
return view('admin/history.overview', [
|
return view('admin/history.overview', [
|
||||||
'history' => $history,
|
'history' => $history,
|
||||||
'page' => $content
|
'page' => $page
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getDiff($revision, $id)
|
/**
|
||||||
|
* @param ContentHistory $revision
|
||||||
|
*
|
||||||
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
|
*/
|
||||||
|
public function getDiff(ContentHistory $revision)
|
||||||
{
|
{
|
||||||
$change = $this->history->findOrFail($id);
|
$diff = $this->history->getDiff($revision);
|
||||||
$diff = $this->history->getDiff($change);
|
|
||||||
|
|
||||||
return view('admin/history.diff', [
|
return view('admin/history.diff', [
|
||||||
'change' => $change,
|
'change' => $revision,
|
||||||
'diff' => $diff
|
'diff' => $diff
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,12 +32,12 @@ class UploadedFilesOverview extends Controller
|
|||||||
*/
|
*/
|
||||||
public function index(Directory $directory = null)
|
public function index(Directory $directory = null)
|
||||||
{
|
{
|
||||||
// include hidden directories?
|
// dd($directory);
|
||||||
$includeHidden = Input::get('hidden');
|
|
||||||
|
|
||||||
|
// include hidden directories?
|
||||||
$subdirectories = $this->directoryRepository->getAllSubdirectories($directory);
|
$subdirectories = $this->directoryRepository->getAllSubdirectories($directory);
|
||||||
|
|
||||||
if (!$includeHidden) {
|
if (!Input::get('hidden', true)) {
|
||||||
$subdirectories = $subdirectories->where('hidden', false);
|
$subdirectories = $subdirectories->where('hidden', false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
namespace App\Http\Controllers\Admin\Widgets\Areas;
|
namespace App\Http\Controllers\Admin\Widgets\Areas;
|
||||||
|
|
||||||
use App\CMS\Repositories\Widgets\WidgetArea as WidgetAreaRepository;
|
use App\CMS\Repositories\Widgets\WidgetArea as WidgetAreaRepository;
|
||||||
|
use App\Events\DeleteWidgetArea;
|
||||||
use App\Http\Controllers\Admin\Controller;
|
use App\Http\Controllers\Admin\Controller;
|
||||||
use App\Http\Requests\EditWidgetAreaRequest;
|
use App\Http\Requests\EditWidgetAreaRequest;
|
||||||
use App\Models\Widgets\Widget;
|
use App\Models\Widgets\Widget;
|
||||||
@@ -39,6 +40,7 @@ class EditWidgetArea extends Controller
|
|||||||
*/
|
*/
|
||||||
public function edit(WidgetArea $widgetArea)
|
public function edit(WidgetArea $widgetArea)
|
||||||
{
|
{
|
||||||
|
return view("test");
|
||||||
$associatedWidgetIds = WidgetInWidgetArea::getWidgetIdsFromArea($widgetArea->id);
|
$associatedWidgetIds = WidgetInWidgetArea::getWidgetIdsFromArea($widgetArea->id);
|
||||||
$widgets = Widget::where('language', LaravelLocalization::getCurrentLocale())
|
$widgets = Widget::where('language', LaravelLocalization::getCurrentLocale())
|
||||||
->paginate(25);
|
->paginate(25);
|
||||||
@@ -83,26 +85,14 @@ class EditWidgetArea extends Controller
|
|||||||
}
|
}
|
||||||
|
|
||||||
// delete area
|
// delete area
|
||||||
$area->delete();
|
$widgetArea->delete();
|
||||||
|
|
||||||
// fire event with new widget area
|
// fire event with new widget area
|
||||||
Event::fire(new \App\Events\DeleteWidgetArea($area));
|
Event::fire(new DeleteWidgetArea($widgetArea));
|
||||||
|
|
||||||
// redirect and inform user
|
// redirect and inform user
|
||||||
return redirect()
|
return redirect()
|
||||||
->route('widgetareas.overview')
|
->route('widgetareas.overview')
|
||||||
->with('success', trans('admin/widgetAreas.successfullyDeleted'));
|
->with('success', trans('admin/widgetAreas.successfullyDeleted'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Redirect user to overview with message about invalid widget area
|
|
||||||
*
|
|
||||||
* @return \Illuminate\Http\RedirectResponse
|
|
||||||
*/
|
|
||||||
private function invalidArea()
|
|
||||||
{
|
|
||||||
return redirect()
|
|
||||||
->route('widgetareas.overview')
|
|
||||||
->with('error', trans('admin/widgetAreas.invalidArea'));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-6
@@ -18,9 +18,7 @@ class Kernel extends HttpKernel
|
|||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The application's global HTTP middleware stack.
|
* The application's global HTTP middleware stack.
|
||||||
*
|
|
||||||
* These middleware are run during every request to your application.
|
* These middleware are run during every request to your application.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $middleware = [
|
protected $middleware = [
|
||||||
@@ -33,7 +31,6 @@ class Kernel extends HttpKernel
|
|||||||
];
|
];
|
||||||
/**
|
/**
|
||||||
* The application's route middleware groups.
|
* The application's route middleware groups.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $middlewareGroups = [
|
protected $middlewareGroups = [
|
||||||
@@ -53,9 +50,7 @@ class Kernel extends HttpKernel
|
|||||||
];
|
];
|
||||||
/**
|
/**
|
||||||
* The application's route middleware.
|
* The application's route middleware.
|
||||||
*
|
|
||||||
* These middleware may be assigned to groups or used individually.
|
* These middleware may be assigned to groups or used individually.
|
||||||
*
|
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
protected $routeMiddleware = [
|
protected $routeMiddleware = [
|
||||||
@@ -66,6 +61,7 @@ class Kernel extends HttpKernel
|
|||||||
'throttle' => ThrottleRequests::class,
|
'throttle' => ThrottleRequests::class,
|
||||||
'localize' => LaravelLocalizationRoutes::class,
|
'localize' => LaravelLocalizationRoutes::class,
|
||||||
'localizationRedirect' => LaravelLocalizationRedirectFilter::class,
|
'localizationRedirect' => LaravelLocalizationRedirectFilter::class,
|
||||||
'localeSessionRedirect' => LocaleSessionRedirect::class
|
'localeSessionRedirect' => LocaleSessionRedirect::class,
|
||||||
|
'bindings' => \Illuminate\Routing\Middleware\SubstituteBindings::class,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -11,7 +11,7 @@ Route::pattern('url', '[0-9\-a-z]+');
|
|||||||
|
|
||||||
/*******************************************************************************/
|
/*******************************************************************************/
|
||||||
|
|
||||||
Route::group(['prefix' => LaravelLocalization::setLocale()], function () {
|
Route::group(['prefix' => LaravelLocalization::setLocale(), 'middleware' => ['bindings']], function () {
|
||||||
/**
|
/**
|
||||||
* This route group serves to handle request in admin
|
* This route group serves to handle request in admin
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,34 +9,34 @@ Route::group(['namespace' => 'Contents'], function () {
|
|||||||
->name('content.new');
|
->name('content.new');
|
||||||
|
|
||||||
// form for editing existing static page
|
// form for editing existing static page
|
||||||
Route::get('content/edit/{id}', 'EditContent@edit')
|
Route::get('content/edit/{page}', 'EditContent@edit')
|
||||||
->name('content.edit');
|
->name('content.edit');
|
||||||
|
|
||||||
// post method for creating new static page
|
// post method for creating new static page
|
||||||
Route::post('content/new/{moduleId}', 'CreateNewContent@store')
|
Route::post('content/new/{module}', 'CreateNewContent@store')
|
||||||
->name('content.newPost');
|
->name('content.newPost');
|
||||||
|
|
||||||
// post method for creating new static page
|
// post method for creating new static page
|
||||||
Route::post('content/edit/{id}', 'EditContent@update')
|
Route::post('content/edit/{page}', 'EditContent@update')
|
||||||
->name('content.editPost');
|
->name('content.editPost');
|
||||||
|
|
||||||
// change status of page (protected, public or draft)
|
// change status of page (protected, public or draft)
|
||||||
Route::get('content/status/{id}/{status}', 'ContentActions@changeStatus')
|
Route::get('content/status/{page}/{status}', 'ContentActions@changeStatus')
|
||||||
->name('content.changeStatus');
|
->name('content.changeStatus');
|
||||||
|
|
||||||
// set homepage
|
// set homepage
|
||||||
Route::get('content/homepage/{id}', 'ContentActions@setHomepage')
|
Route::get('content/homepage/{page}', 'ContentActions@setHomepage')
|
||||||
->name('content.setHomepage');
|
->name('content.setHomepage');
|
||||||
|
|
||||||
// delete page
|
// delete page
|
||||||
Route::get('content/delete/{id}', 'ContentActions@delete')
|
Route::get('content/delete/{page}', 'ContentActions@delete')
|
||||||
->name('content.delete');
|
->name('content.delete');
|
||||||
|
|
||||||
// history of changes for specified page
|
// history of changes for specified page
|
||||||
Route::get('history/{id}', 'History@getOverview')
|
Route::get('history/{page}', 'History@getOverview')
|
||||||
->name('content.history');
|
->name('content.history');
|
||||||
|
|
||||||
// history of changes for specified page
|
// history of changes for specified page
|
||||||
Route::get('history/{revision}/{id}', 'History@getDiff')
|
Route::get('history/{revision}', 'History@getDiff')
|
||||||
->name('history.diff');
|
->name('history.diff');
|
||||||
});
|
});
|
||||||
@@ -27,4 +27,9 @@ class Module extends Model
|
|||||||
'is_template' => 'boolean',
|
'is_template' => 'boolean',
|
||||||
'has_submodules' => 'boolean'
|
'has_submodules' => 'boolean'
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public function getRouteKeyName()
|
||||||
|
{
|
||||||
|
return 'alias';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,30 +2,45 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Routing\Router;
|
|
||||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||||
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
class RouteServiceProvider extends ServiceProvider
|
class RouteServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* This namespace is applied to the controller routes in your routes file.
|
* This namespace is applied to your controller routes.
|
||||||
*
|
|
||||||
* In addition, it is set as the URL generator's root namespace.
|
* In addition, it is set as the URL generator's root namespace.
|
||||||
*
|
|
||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
protected $namespace = 'App\Http\Controllers';
|
protected $namespace = 'App\Http\Controllers';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define the routes for the application.
|
* Define your route model bindings, pattern filters, etc.
|
||||||
*
|
|
||||||
* @param \Illuminate\Routing\Router $router
|
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function map(Router $router)
|
public function boot()
|
||||||
{
|
{
|
||||||
$router->group(['namespace' => $this->namespace], function ($router) {
|
parent::boot();
|
||||||
require app_path('Http/routes.php');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
/**
|
||||||
|
* Define the routes for the application.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function map()
|
||||||
|
{
|
||||||
|
$this->mapWebRoutes();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Define the "web" routes for the application.
|
||||||
|
* These routes all receive session state, CSRF protection, etc.
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
protected function mapWebRoutes()
|
||||||
|
{
|
||||||
|
Route::namespace($this->namespace)
|
||||||
|
->middleware('web')
|
||||||
|
->group(app_path('Http/routes.php'));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,9 +1,8 @@
|
|||||||
<?php namespace Modules\Categories\Http\Controllers;
|
<?php namespace Modules\Categories\Http\Controllers;
|
||||||
|
|
||||||
use App\CMS\Enumerations\ModuleNamesWithIds;
|
use App\CMS\Enumerations\ModuleNamesWithIds;
|
||||||
use App\Models\Module;
|
use App\Http\Controllers\Admin\Controller;
|
||||||
use Modules\Categories\Entities\Category;
|
use Modules\Categories\Entities\Category;
|
||||||
use Pingpong\Modules\Routing\Controller;
|
|
||||||
|
|
||||||
class CategoriesOverview extends Controller
|
class CategoriesOverview extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,17 +1,16 @@
|
|||||||
<?php namespace Modules\Categories\Http\Controllers;
|
<?php namespace Modules\Categories\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Admin\Controller;
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\Module;
|
use App\Models\Module;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Modules\Categories\Entities\Category;
|
use Modules\Categories\Entities\Category;
|
||||||
use Pingpong\Modules\Routing\Controller;
|
|
||||||
|
|
||||||
class CreateNewCategory extends Controller
|
class CreateNewCategory extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Display form for new category
|
* Display form for new category
|
||||||
*
|
|
||||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||||
*/
|
*/
|
||||||
public function getNew()
|
public function getNew()
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
<?php namespace Modules\Categories\Http\Controllers;
|
<?php namespace Modules\Categories\Http\Controllers;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Admin\Controller;
|
||||||
use App\Http\Requests\Request;
|
use App\Http\Requests\Request;
|
||||||
use App\Models\Module;
|
use App\Models\Module;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
use Modules\Categories\Entities\Category;
|
use Modules\Categories\Entities\Category;
|
||||||
use Pingpong\Modules\Routing\Controller;
|
|
||||||
|
|
||||||
class EditCategory extends Controller
|
class EditCategory extends Controller
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,24 +3,33 @@
|
|||||||
@section('pageHeading', trans('categories::categories.overview'))
|
@section('pageHeading', trans('categories::categories.overview'))
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
@if(count($categories))
|
|
||||||
<table class="table table-striped">
|
<div class="card items">
|
||||||
<thead>
|
<div class="card-block">
|
||||||
<tr>
|
|
||||||
<th>@lang('categories::categories.name')</th>
|
@if(count($categories))
|
||||||
<th>@lang('categories::categories.module')</th>
|
<div class="item-list striped rows-striped">
|
||||||
<th>@lang('categories::categories.actions')</th>
|
|
||||||
</tr>
|
<table class="table table-striped">
|
||||||
</thead>
|
<thead>
|
||||||
<tbody>
|
<tr>
|
||||||
@foreach($categories as $category)
|
<th>@lang('categories::categories.name')</th>
|
||||||
@include('categories::admin.snippets.overviewRow', ['level' => 0, 'currentCategory' => $category])
|
<th>@lang('categories::categories.module')</th>
|
||||||
@endforeach
|
<th>@lang('categories::categories.actions')</th>
|
||||||
</tbody>
|
</tr>
|
||||||
</table>
|
</thead>
|
||||||
@else
|
<tbody>
|
||||||
<div class="alert alert-info">
|
@foreach($categories as $category)
|
||||||
@lang('categories::categories.noCategories')
|
@include('categories::admin.snippets.overviewRow', ['level' => 0, 'currentCategory' => $category])
|
||||||
|
@endforeach
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
@else
|
||||||
|
<div class="alert alert-info">
|
||||||
|
@lang('categories::categories.noCategories')
|
||||||
|
</div>
|
||||||
|
@endif
|
||||||
</div>
|
</div>
|
||||||
@endif
|
</div>
|
||||||
@stop
|
@stop
|
||||||
@@ -1,11 +1,33 @@
|
|||||||
<tr>
|
<tr>
|
||||||
<td>
|
<td>
|
||||||
{{str_repeat('-', $level)}} {{$currentCategory['name']}}
|
{{str_repeat('-', $level)}} <a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}">{{$currentCategory['name']}}</a>
|
||||||
</td>
|
</td>
|
||||||
<td>@lang($modules[$currentCategory['module_id']])</td>
|
<td>@lang($modules[$currentCategory['module_id']])</td>
|
||||||
<td>
|
<td>
|
||||||
<a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}"><i class="fa fa-fw fa-edit"></i></a>
|
<div class="item-actions-dropdown">
|
||||||
<a class="confirm" href="{{route('categories.delete', ['id' => $currentCategory['id']])}}"><i class="fa fa-fw fa-remove"></i></a>
|
<a class="item-actions-toggle-btn">
|
||||||
|
<span class="inactive">
|
||||||
|
<i class="fa fa-cog"></i>
|
||||||
|
</span>
|
||||||
|
<span class="active">
|
||||||
|
<i class="fa fa-chevron-circle-right"></i>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
<div class="item-actions-block">
|
||||||
|
<ul class="item-actions-list">
|
||||||
|
|
||||||
|
<li>
|
||||||
|
<a href="{{route('categories.edit', ['id' => $currentCategory['id']])}}"><i
|
||||||
|
class="fa fa-fw fa-pencil"></i></a>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<a class="confirm remove"
|
||||||
|
href="{{route('categories.delete', ['id' => $currentCategory['id']])}}"><i
|
||||||
|
class="fa fa-fw fa-trash"></i></a>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
{
|
|
||||||
"name": "pingpong-modules/categories",
|
|
||||||
"description": "",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "Pingpong Labs",
|
|
||||||
"email": "pingpong.labs@gmail.com"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"autoload": {
|
|
||||||
"psr-4": {
|
|
||||||
"Modules\\Categories\\": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -187,9 +187,8 @@ class Gallery implements AppHandler
|
|||||||
$menu = \Menu::instance('mainMenu');
|
$menu = \Menu::instance('mainMenu');
|
||||||
$submenu = $menu->whereTitle(trans('admin/mainMenu.contentPages'));
|
$submenu = $menu->whereTitle(trans('admin/mainMenu.contentPages'));
|
||||||
$submenu->dropdown(trans('gallery::module.name'), function ($submenu) use ($user) {
|
$submenu->dropdown(trans('gallery::module.name'), function ($submenu) use ($user) {
|
||||||
$submenu->route('content.new', trans('gallery::admin/adminMenu.new'), ['moduleId' => self::getModuleId()], 10, ['icon' => 'fa fa-plus']);
|
$submenu->route('content.new', trans('gallery::admin/adminMenu.new'), ['module' => 'gallery'], 10, ['icon' => 'fa fa-plus']);
|
||||||
$submenu->route('content.overview', trans('gallery::admin/adminMenu.overview'), ['moduleId' => self::getModuleId()], 20, ['icon' => 'fa fa-list']);
|
$submenu->route('content.overview', trans('gallery::admin/adminMenu.overview'), ['module' => 'gallery'], 20, ['icon' => 'fa fa-list']);
|
||||||
// $submenu->route('emails.sent', trans('contactform::admin/adminMenu.sentMessages'), [], 30, ['icon' => 'fa fa-send']);
|
|
||||||
}, 25, ['icon' => 'fa fa-camera']);
|
}, 25, ['icon' => 'fa fa-camera']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
@section('headerButtons')
|
@section('headerButtons')
|
||||||
|
|
||||||
@if($module->exists === true)
|
@if($module->exists === true)
|
||||||
<a href="{{route('content.new', ['moduleId' => $module->id])}}" class="btn btn-primary btn-sm rounded">
|
<a href="{{route('content.new', ['module' => $module])}}" class="btn btn-primary btn-sm rounded">
|
||||||
<i class="fa fa-plus"></i>
|
<i class="fa fa-plus"></i>
|
||||||
</a>
|
</a>
|
||||||
@endif
|
@endif
|
||||||
@@ -36,7 +36,7 @@
|
|||||||
@foreach($pages as $page)
|
@foreach($pages as $page)
|
||||||
<div class="row p-tb-15">
|
<div class="row p-tb-15">
|
||||||
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
|
<div class="col-md-1 hidden-sm-down text-center with-placeholder">
|
||||||
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
<a href="{{route('content.edit', ['page' => $page])}}">
|
||||||
@if(!view()->exists(template_name($page->template, false)))
|
@if(!view()->exists(template_name($page->template, false)))
|
||||||
<i class="fa fa-2x text-warning fa-warning" data-toggle="tooltip"
|
<i class="fa fa-2x text-warning fa-warning" data-toggle="tooltip"
|
||||||
title="@lang('admin/contents.invalidTemplateSelected')"></i>
|
title="@lang('admin/contents.invalidTemplateSelected')"></i>
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xs-10 col-md-3 col-lg-4">
|
<div class="col-xs-10 col-md-3 col-lg-4">
|
||||||
<a href="{{route('content.edit', ['id' => $page->id])}}">
|
<a href="{{route('content.edit', ['page' => $page])}}">
|
||||||
{{$page->title}}
|
{{$page->title}}
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@@ -66,7 +66,7 @@
|
|||||||
@else tag-warning @endif">{{$statuses[$page->status]}}</span>
|
@else tag-warning @endif">{{$statuses[$page->status]}}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-lg-2 col-md-3 hidden-sm-down">
|
<div class="col-lg-2 col-md-3 hidden-sm-down">
|
||||||
<a href="{{route('content.overview', ['moduleId' => $page->module_id])}}">
|
<a href="{{route('content.overview', ['module' => $page->module->alias])}}">
|
||||||
{{trans($page->module_name)}}
|
{{trans($page->module_name)}}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
@@ -87,7 +87,7 @@
|
|||||||
@if(!$page->isHomepage)
|
@if(!$page->isHomepage)
|
||||||
<li>
|
<li>
|
||||||
|
|
||||||
<a href="{{route('content.setHomepage', ['id' => $page->id])}}"
|
<a href="{{route('content.setHomepage', ['page' => $page])}}"
|
||||||
data-toggle="tooltip"
|
data-toggle="tooltip"
|
||||||
title="@lang('admin/contents.setHomepage')">
|
title="@lang('admin/contents.setHomepage')">
|
||||||
<i class="fa fa-home"></i>
|
<i class="fa fa-home"></i>
|
||||||
@@ -96,7 +96,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a class="edit" href="{{route('content.edit', ['id' => $page->id])}}"
|
<a class="edit" href="{{route('content.edit', ['page' => $page])}}"
|
||||||
data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
|
data-toggle="tooltip" title="@lang('admin/contents.editPlain')">
|
||||||
<i class="fa fa-pencil"></i>
|
<i class="fa fa-pencil"></i>
|
||||||
</a>
|
</a>
|
||||||
@@ -104,14 +104,14 @@
|
|||||||
|
|
||||||
@if($page->isDraft())
|
@if($page->isDraft())
|
||||||
<li>
|
<li>
|
||||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => 'public'])}}"
|
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'public'])}}"
|
||||||
class="confirm" data-toggle="tooltip"
|
class="confirm" data-toggle="tooltip"
|
||||||
title="@lang('admin/contents.makePublic')">
|
title="@lang('admin/contents.makePublic')">
|
||||||
<i class="fa fa-eye"></i>
|
<i class="fa fa-eye"></i>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => 'protected'])}}"
|
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'protected'])}}"
|
||||||
class="confirm" data-toggle="tooltip"
|
class="confirm" data-toggle="tooltip"
|
||||||
title="@lang('admin/contents.makeProtected')">
|
title="@lang('admin/contents.makeProtected')">
|
||||||
<i class="fa fa-lock"></i>
|
<i class="fa fa-lock"></i>
|
||||||
@@ -126,7 +126,7 @@
|
|||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
<a href="{{route('content.changeStatus', ['id' => $page->id, 'status' => 'draft'])}}"
|
<a href="{{route('content.changeStatus', ['page' => $page, 'status' => 'draft'])}}"
|
||||||
class="button tiny warning confirm" data-toggle="tooltip"
|
class="button tiny warning confirm" data-toggle="tooltip"
|
||||||
title="@lang('admin/contents.makeDraft')">
|
title="@lang('admin/contents.makeDraft')">
|
||||||
<i class="fa fa-eye-slash"></i>
|
<i class="fa fa-eye-slash"></i>
|
||||||
@@ -135,7 +135,7 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<li>
|
<li>
|
||||||
<a href="{{route('content.delete', ['id' => $page->id])}}"
|
<a href="{{route('content.delete', ['page' => $page])}}"
|
||||||
class="button tiny alert remove confirm" data-toggle="tooltip"
|
class="button tiny alert remove confirm" data-toggle="tooltip"
|
||||||
title="@lang('admin/contents.deletePage')"><i
|
title="@lang('admin/contents.deletePage')"><i
|
||||||
class="fa fa-trash-o"></i>
|
class="fa fa-trash-o"></i>
|
||||||
|
|||||||
@@ -14,6 +14,8 @@
|
|||||||
<div class="col-lg-4">
|
<div class="col-lg-4">
|
||||||
<h3>@lang('admin/widgets.preview')</h3>
|
<h3>@lang('admin/widgets.preview')</h3>
|
||||||
|
|
||||||
|
{{-- {{dd($area)}}--}}
|
||||||
|
|
||||||
@widgetArea($area->code)
|
@widgetArea($area->code)
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user