From 4685d1042438ae95b8fb17d9366c84dbadca3338 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:08:03 +0100 Subject: [PATCH 1/7] FEATURE: init pingpong/menus --- composer.json | 3 ++- composer.lock | 56 +++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 56 insertions(+), 3 deletions(-) diff --git a/composer.json b/composer.json index f74cc55c..4d7818d6 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,8 @@ "php": ">=5.5.9", "laravel/framework": "5.2.*", "phpmailer/phpmailer": "^5.2", - "pingpong/modules": "~2.0" + "pingpong/modules": "~2.0", + "pingpong/menus": "^2.2" }, "require-dev": { "fzaninotto/faker": "~1.4", diff --git a/composer.lock b/composer.lock index 9472dc5a..28ee49cf 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "27cde2cd04e297873d56aa999ffbfb68", - "content-hash": "3fc78d80cf6d04d2e213062f07ce40af", + "hash": "e1df7a663824f03abec6a4688a30e0d3", + "content-hash": "f6d1dca260e16530b88c6572ad98598e", "packages": [ { "name": "classpreloader/classpreloader", @@ -1434,6 +1434,58 @@ ], "time": "2016-01-06 08:28:33" }, + { + "name": "pingpong/menus", + "version": "2.2.0", + "source": { + "type": "git", + "url": "https://github.com/pingpong-labs/menus.git", + "reference": "ecb400916b6189e66c2ed1f91a8cffa58fd7f83a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pingpong-labs/menus/zipball/ecb400916b6189e66c2ed1f91a8cffa58fd7f83a", + "reference": "ecb400916b6189e66c2ed1f91a8cffa58fd7f83a", + "shasum": "" + }, + "require": { + "illuminate/config": "5.2.*", + "illuminate/support": "5.2.*", + "illuminate/view": "5.2.*", + "laravelcollective/html": "~5.0", + "php": ">=5.5.9" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pingpong\\Menus\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pingpong Labs", + "email": "pingpong.labs@gmail.com" + } + ], + "description": "Laravel Menus", + "keywords": [ + "bootstrap", + "laravel", + "menus", + "nav", + "navigation", + "pingpong" + ], + "time": "2016-01-12 03:54:35" + }, { "name": "pingpong/modules", "version": "v2.2.0", From 384edd3a7ee75611b9034d6701dab0b31f785b4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:13:40 +0100 Subject: [PATCH 2/7] FEATURE: init service provider of Menu builder in config files --- app/Http/routes.php | 2 +- app/Providers/AppServiceProvider.php | 1 + config/app.php | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/Http/routes.php b/app/Http/routes.php index b7b85794..d1c73dc8 100644 --- a/app/Http/routes.php +++ b/app/Http/routes.php @@ -31,6 +31,6 @@ Route::group([ 'namespace' => 'Admin', 'prefix' => 'admin' ], function () { - Route::get('/', 'Dashboard@showIndex'); + Route::get('/', 'Dashboard@getIndex'); }); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index fe20b05b..902827c6 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -28,5 +28,6 @@ class AppServiceProvider extends ServiceProvider } $this->app->register('Pingpong\Modules\ModulesServiceProvider'); + $this->app->register('Pingpong\Menus\MenusServiceProvider'); } } diff --git a/config/app.php b/config/app.php index 77c3124b..79f5df76 100644 --- a/config/app.php +++ b/config/app.php @@ -147,7 +147,7 @@ return [ Illuminate\Translation\TranslationServiceProvider::class, Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, - + Pingpong\Menus\MenusServiceProvider::class, /* * Application Service Providers... */ @@ -189,6 +189,7 @@ return [ 'Lang' => Illuminate\Support\Facades\Lang::class, 'Log' => Illuminate\Support\Facades\Log::class, 'Mail' => Illuminate\Support\Facades\Mail::class, + 'Menu' => Pingpong\Menus\MenuFacade::class, 'Password' => Illuminate\Support\Facades\Password::class, 'Queue' => Illuminate\Support\Facades\Queue::class, 'Redirect' => Illuminate\Support\Facades\Redirect::class, From 9048c552edce5e141adad16966685de3911347da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:14:20 +0100 Subject: [PATCH 3/7] REFACTORING: reformatted code in config/app.php --- config/app.php | 30 ++++++++++-------------------- 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/config/app.php b/config/app.php index 79f5df76..5dcd368d 100644 --- a/config/app.php +++ b/config/app.php @@ -13,8 +13,7 @@ return [ | */ - 'env' => env('APP_ENV', 'production'), - + 'env' => env('APP_ENV', 'production'), /* |-------------------------------------------------------------------------- | Application Debug Mode @@ -26,8 +25,7 @@ return [ | */ - 'debug' => env('APP_DEBUG', false), - + 'debug' => env('APP_DEBUG', false), /* |-------------------------------------------------------------------------- | Application URL @@ -39,8 +37,7 @@ return [ | */ - 'url' => 'http://localhost', - + 'url' => 'http://localhost', /* |-------------------------------------------------------------------------- | Application Timezone @@ -52,8 +49,7 @@ return [ | */ - 'timezone' => 'UTC', - + 'timezone' => 'UTC', /* |-------------------------------------------------------------------------- | Application Locale Configuration @@ -65,8 +61,7 @@ return [ | */ - 'locale' => 'en', - + 'locale' => 'en', /* |-------------------------------------------------------------------------- | Application Fallback Locale @@ -79,7 +74,6 @@ return [ */ 'fallback_locale' => 'en', - /* |-------------------------------------------------------------------------- | Encryption Key @@ -91,10 +85,8 @@ return [ | */ - 'key' => env('APP_KEY'), - - 'cipher' => 'AES-256-CBC', - + 'key' => env('APP_KEY'), + 'cipher' => 'AES-256-CBC', /* |-------------------------------------------------------------------------- | Logging Configuration @@ -108,8 +100,7 @@ return [ | */ - 'log' => env('APP_LOG', 'single'), - + 'log' => env('APP_LOG', 'single'), /* |-------------------------------------------------------------------------- | Autoloaded Service Providers @@ -121,7 +112,7 @@ return [ | */ - 'providers' => [ + 'providers' => [ /* * Laravel Framework Service Providers... @@ -158,7 +149,6 @@ return [ App\Providers\GlobalViewDataProvider::class, ], - /* |-------------------------------------------------------------------------- | Class Aliases @@ -170,7 +160,7 @@ return [ | */ - 'aliases' => [ + 'aliases' => [ 'App' => Illuminate\Support\Facades\App::class, 'Artisan' => Illuminate\Support\Facades\Artisan::class, From f1da02003a837cb15bcc794b66da57d91eaef9da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:15:49 +0100 Subject: [PATCH 4/7] FEATURE: copied config of modules and menus --- config/menus.php | 16 +++++ config/modules.php | 160 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 176 insertions(+) create mode 100644 config/menus.php create mode 100644 config/modules.php diff --git a/config/menus.php b/config/menus.php new file mode 100644 index 00000000..70d950b0 --- /dev/null +++ b/config/menus.php @@ -0,0 +1,16 @@ + [ + 'navbar' => 'Pingpong\Menus\Presenters\Bootstrap\NavbarPresenter', + 'navbar-right' => 'Pingpong\Menus\Presenters\Bootstrap\NavbarRightPresenter', + 'nav-pills' => 'Pingpong\Menus\Presenters\Bootstrap\NavPillsPresenter', + 'nav-tab' => 'Pingpong\Menus\Presenters\Bootstrap\NavTabPresenter', + 'sidebar' => 'Pingpong\Menus\Presenters\Bootstrap\SidebarMenuPresenter', + 'navmenu' => 'Pingpong\Menus\Presenters\Bootstrap\NavMenuPresenter', + ], + + 'ordering' => false, + +]; diff --git a/config/modules.php b/config/modules.php new file mode 100644 index 00000000..80edfbbb --- /dev/null +++ b/config/modules.php @@ -0,0 +1,160 @@ + 'Modules', + + /* + |-------------------------------------------------------------------------- + | Module Stubs + |-------------------------------------------------------------------------- + | + | Default module stubs. + | + */ + + 'stubs' => [ + 'enabled' => false, + 'path' => base_path().'/vendor/pingpong/modules/src/Pingpong/Modules/Commands/stubs', + 'files' => [ + 'start' => 'start.php', + 'routes' => 'Http/routes.php', + 'json' => 'module.json', + 'views/index' => 'Resources/views/index.blade.php', + 'views/master' => 'Resources/views/layouts/master.blade.php', + 'scaffold/config' => 'Config/config.php', + 'composer' => 'composer.json', + ], + 'replacements' => [ + 'start' => ['LOWER_NAME'], + 'routes' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'json' => ['LOWER_NAME', 'STUDLY_NAME', 'MODULE_NAMESPACE'], + 'views/index' => ['LOWER_NAME'], + 'views/master' => ['STUDLY_NAME'], + 'scaffold/config' => ['STUDLY_NAME'], + 'composer' => [ + 'LOWER_NAME', + 'STUDLY_NAME', + 'VENDOR', + 'AUTHOR_NAME', + 'AUTHOR_EMAIL', + 'MODULE_NAMESPACE', + ], + ], + ], + 'paths' => [ + /* + |-------------------------------------------------------------------------- + | Modules path + |-------------------------------------------------------------------------- + | + | This path used for save the generated module. This path also will added + | automatically to list of scanned folders. + | + */ + + 'modules' => base_path('modules'), + /* + |-------------------------------------------------------------------------- + | Modules assets path + |-------------------------------------------------------------------------- + | + | Here you may update the modules assets path. + | + */ + + 'assets' => public_path('modules'), + /* + |-------------------------------------------------------------------------- + | The migrations path + |-------------------------------------------------------------------------- + | + | Where you run 'module:publish-migration' command, where do you publish the + | the migration files? + | + */ + + 'migration' => base_path('database/migrations'), + /* + |-------------------------------------------------------------------------- + | Generator path + |-------------------------------------------------------------------------- + | + | Here you may update the modules generator path. + | + */ + + 'generator' => [ + 'assets' => 'Assets', + 'config' => 'Config', + 'command' => 'Console', + 'migration' => 'Database/Migrations', + 'model' => 'Entities', + 'repository' => 'Repositories', + 'seeder' => 'Database/Seeders', + 'controller' => 'Http/Controllers', + 'filter' => 'Http/Middleware', + 'request' => 'Http/Requests', + 'provider' => 'Providers', + 'lang' => 'Resources/lang', + 'views' => 'Resources/views', + 'test' => 'Tests', + ], + ], + /* + |-------------------------------------------------------------------------- + | Scan Path + |-------------------------------------------------------------------------- + | + | Here you define which folder will be scanned. By default will scan vendor + | directory. This is useful if you host the package in packagist website. + | + */ + + 'scan' => [ + 'enabled' => false, + 'paths' => [ + base_path('vendor/*/*'), + ], + ], + /* + |-------------------------------------------------------------------------- + | Composer File Template + |-------------------------------------------------------------------------- + | + | Here is the config for composer.json file, generated by this package + | in every module since version >= 1.2.0. + | + */ + + 'composer' => [ + 'vendor' => 'pingpong-modules', + 'author' => [ + 'name' => 'Pingpong Labs', + 'email' => 'pingpong.labs@gmail.com', + ], + ], + /* + |-------------------------------------------------------------------------- + | Caching + |-------------------------------------------------------------------------- + | + | Here is the config for setting up caching feature. + | + */ + 'cache' => [ + 'enabled' => false, + 'key' => 'pingpong-modules', + 'lifetime' => 60, + ], + +]; From 349e9d49f93fdb1c3a3c6e9b77416e5316e66784 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:16:15 +0100 Subject: [PATCH 5/7] FEATURE: add resources/views/vendor into .gitignore file --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 4ff2efca..6a3f5855 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +/resources/views/vendor +!/resources/views/vendor/.gitkeep /.env /vendor /.idea From 94227a4b9782c9b9996373b5f364fa62e9f55c4f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:28:46 +0100 Subject: [PATCH 6/7] FEATURE: changed inheritance in dashboard controller --- app/Http/Controllers/Admin/Dashboard.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/Admin/Dashboard.php b/app/Http/Controllers/Admin/Dashboard.php index 29438702..52e563d1 100644 --- a/app/Http/Controllers/Admin/Dashboard.php +++ b/app/Http/Controllers/Admin/Dashboard.php @@ -3,12 +3,18 @@ namespace App\Http\Controllers\Admin; use Illuminate\Http\Request; - use App\Http\Requests; -use App\Http\Controllers\Controller; class Dashboard extends Controller { + /** + * Dashboard constructor. + */ + public function __construct() + { + parent::__construct(); + } + public function getIndex() { echo "dasboard"; } From 2e8f42efe22507dc3e4e72d90bc6818ad0be0f72 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20Kv=C3=A1=C4=8Dek?= Date: Thu, 21 Jan 2016 12:29:09 +0100 Subject: [PATCH 7/7] FEATURE: add template for dashboard --- app/Http/Controllers/Admin/Controller.php | 24 +++++++++++++++++++++++ app/Http/Controllers/Admin/Dashboard.php | 2 +- resources/views/admin/dashboard.blade.php | 9 +++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 app/Http/Controllers/Admin/Controller.php create mode 100644 resources/views/admin/dashboard.blade.php diff --git a/app/Http/Controllers/Admin/Controller.php b/app/Http/Controllers/Admin/Controller.php new file mode 100644 index 00000000..f71a5b90 --- /dev/null +++ b/app/Http/Controllers/Admin/Controller.php @@ -0,0 +1,24 @@ +menu = Menu::instance('navbar'); + + var_dump($this->menu); + } +} diff --git a/app/Http/Controllers/Admin/Dashboard.php b/app/Http/Controllers/Admin/Dashboard.php index 52e563d1..aa6bd5a2 100644 --- a/app/Http/Controllers/Admin/Dashboard.php +++ b/app/Http/Controllers/Admin/Dashboard.php @@ -16,6 +16,6 @@ class Dashboard extends Controller } public function getIndex() { - echo "dasboard"; + return view('admin.dashboard'); } } diff --git a/resources/views/admin/dashboard.blade.php b/resources/views/admin/dashboard.blade.php new file mode 100644 index 00000000..0dbc0a2f --- /dev/null +++ b/resources/views/admin/dashboard.blade.php @@ -0,0 +1,9 @@ +@extends('admin.layout') + +@section('content') + +
+

Dashboard

+
+ +@stop \ No newline at end of file