FEATURE: add menu for static pages.
This commit adds menu items into admin. No real functionality is done, however registering menu items works, routing works, translations works.
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
namespace Modules\StaticPages\Http\Controllers\Admin;
|
||||
|
||||
use Pingpong\Modules\Routing\Controller as BaseController;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Modules\StaticPages\Http\Controllers\Admin;
|
||||
|
||||
class CreateNewStaticPage extends Controller
|
||||
{
|
||||
public function getNew()
|
||||
{
|
||||
return view('staticpages::index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Modules\StaticPages\Http\Controllers\Admin;
|
||||
|
||||
class EditStaticPage extends Controller
|
||||
{
|
||||
public function getEdit($id)
|
||||
{
|
||||
return view('staticpages::index');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Modules\StaticPages\Http\Controllers\Admin;
|
||||
|
||||
|
||||
class StaticPageOverview extends Controller
|
||||
{
|
||||
public function getOverview()
|
||||
{
|
||||
return view('staticpages::admin.overview');
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
<?php namespace Modules\Staticpages\Http\Controllers;
|
||||
<?php
|
||||
namespace Modules\StaticPages\Http\Controllers;
|
||||
|
||||
use Pingpong\Modules\Routing\Controller;
|
||||
|
||||
class StaticPagesController extends Controller {
|
||||
|
||||
public function index()
|
||||
{
|
||||
return view('staticpages::index');
|
||||
}
|
||||
|
||||
class StaticPagesController extends Controller
|
||||
{
|
||||
public function index()
|
||||
{
|
||||
return view('staticpages::index');
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,24 @@
|
||||
<?php
|
||||
|
||||
Route::group(['middleware' => 'web', 'prefix' => 'staticpages', 'namespace' => 'Modules\StaticPages\Http\Controllers'], function()
|
||||
{
|
||||
Route::get('/', 'StaticPagesController@index');
|
||||
Route::group([
|
||||
'middleware' => 'web',
|
||||
'prefix' => 'page',
|
||||
'namespace' => 'Modules\StaticPages\Http\Controllers'
|
||||
], function () {
|
||||
Route::get('/{url}', 'StaticPagesController@index');
|
||||
});
|
||||
|
||||
|
||||
// routes group for admin area
|
||||
Route::group([
|
||||
'middleware' => ['web', 'auth'],
|
||||
'prefix' => 'admin/pages',
|
||||
'namespace' => 'Modules\StaticPages\Http\Controllers\Admin'
|
||||
], function () {
|
||||
Route::get('overview', 'StaticPageOverview@getOverview')
|
||||
->name('staticpage.overview');
|
||||
Route::get('new', 'CreateNewStaticPage@getNew')
|
||||
->name('staticpage.new');
|
||||
Route::get('edit/{id}', 'EditStaticPage@getEdit')
|
||||
->name('staticpage.edit');
|
||||
});
|
||||
@@ -1,5 +1,6 @@
|
||||
<?php namespace Modules\Staticpages\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Lang;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class StaticPagesServiceProvider extends ServiceProvider {
|
||||
@@ -21,6 +22,13 @@ class StaticPagesServiceProvider extends ServiceProvider {
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
|
||||
// register links in admin menu
|
||||
$menu = \Menu::instance('mainMenu');
|
||||
$menu->dropdown(trans('staticpages::adminMenu.staticPages'), function($submenu) {
|
||||
$submenu->route('staticpage.new', trans('staticpages::adminMenu.new'));
|
||||
$submenu->route('staticpage.overview', trans('staticpages::adminMenu.overview'));
|
||||
}, 15, ['icon' => 'fa fa-newspaper-o']);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -75,13 +83,7 @@ class StaticPagesServiceProvider extends ServiceProvider {
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = base_path('resources/lang/modules/staticpages');
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, 'staticpages');
|
||||
} else {
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'staticpages');
|
||||
}
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'staticpages');
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
return [
|
||||
'overview' => 'List of all static pages',
|
||||
'new' => 'Create new static page'
|
||||
];
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
return [
|
||||
'staticPages' => 'Static pages',
|
||||
'new' => 'Create new',
|
||||
'overview' => 'Overview'
|
||||
];
|
||||
@@ -0,0 +1,7 @@
|
||||
@extends('admin/layout')
|
||||
|
||||
@section('content')
|
||||
<div class="row">
|
||||
<h1>@lang('staticpages::admin.overview')</h1>
|
||||
</div>
|
||||
@stop
|
||||
@@ -1,12 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Module StaticPages</title>
|
||||
</head>
|
||||
<body>
|
||||
@yield('content')
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user