diff --git a/app/CMS/Handlers/Registrators/SearchEngineRegistrator.php b/app/CMS/Handlers/Registrators/SearchEngineRegistrator.php index 09f35c54..a11edc15 100644 --- a/app/CMS/Handlers/Registrators/SearchEngineRegistrator.php +++ b/app/CMS/Handlers/Registrators/SearchEngineRegistrator.php @@ -1,7 +1,7 @@ where('enabled', true) ->first(); - - // todo remove after adding $casts into Module model - if ($template) { - $template->module_settings = json_decode($template->module_settings); - } - - return $template; }); diff --git a/app/Providers/ModuleServiceProvider.php b/app/CMS/Modules/ServiceProviders/ServiceProvider.php similarity index 90% rename from app/Providers/ModuleServiceProvider.php rename to app/CMS/Modules/ServiceProviders/ServiceProvider.php index a121b014..af2b69a6 100644 --- a/app/Providers/ModuleServiceProvider.php +++ b/app/CMS/Modules/ServiceProviders/ServiceProvider.php @@ -1,13 +1,13 @@ '$Module$', + 'translatedName' => '$module$::$module$.name', + 'translatedDescription' => '$module$::$module$.description', + 'alias' => 'categories', + 'handler' => \Modules\$Module$\Handlers\$Module$Handler::class, + 'providers' => [\Modules\$Module$\Providers\$Module$ServiceProvider::class], + 'files' => ['Http/routes.php'], + 'order' => 0, +]; \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Entities/$Entity$.stub b/app/CMS/Modules/Stubs/Entities/$Entity$.stub new file mode 100644 index 00000000..18a9ffa8 --- /dev/null +++ b/app/CMS/Modules/Stubs/Entities/$Entity$.stub @@ -0,0 +1,8 @@ +dropdown(trans('$module$::$module$.name'), function ($submenu) use ($user) { + $submenu->route('$module$.overview', trans('$module$::$module$.overview'), [], 20, ['icon' => 'fa fa-fw fa-list']); + $submenu->route('$module$.new', trans('$module$::$module$.new'), [], 21, ['icon' => 'fa fa-fw fa-plus']); + }, 15, ['icon' => 'fa fa-fw']); + + + + // TODO: add admin menu entries + } + + /** + * Does this module support categories? + * @return boolean + */ + public static function supportCategories() + { + return true; + } +} \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Http/Controllers/Admin/$Module$.stub b/app/CMS/Modules/Stubs/Http/Controllers/Admin/$Module$.stub new file mode 100644 index 00000000..8f868ef0 --- /dev/null +++ b/app/CMS/Modules/Stubs/Http/Controllers/Admin/$Module$.stub @@ -0,0 +1,103 @@ +$module$Repository = $$module$Repository; + } + + /** + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function index() + { + $items = $Entity$Entity::all(); + + return view('$module$::admin/index', compact('items')); + } + + /** + * Display form for updating entity + * + * @param $Entity$Entity $entity + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function edit($Entity$Entity $entity) + { + return view('$module$::admin/update', compact('entity')); + } + + /** + * Update existing entity + * + * @param Update$Entity$ $request + * @param $Entity$Entity $item + * + * @return \Illuminate\Http\RedirectResponse + */ + public function update(Update$Entity$ $request, $Entity$Entity $entity) + { + + // ... + + $this->$module$Repository->update($entity, $request->all()); + + return redirect() + ->back() + ->with('success', trans('$module$.$module.successfullyUpdated')); + } + + /** + * Display form for creating new entity + * + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public function create() { + $entity = new $Entity$Entity(); + + return view('$module$::admin/create', compact('entity')); + } + + /** + * Create new instance of entity + */ + public function store(Create$Entity$ $request) { + // ... + + $this->$module$Repository->create($request->all()); + + return redirect() + ->back() + ->with('success', trans('$module$.$module.successfullyUpdated')); + } + + /** + * Delete entity + * + * @param $Entity$ $entity + * + * @return \Illuminate\Http\RedirectResponse + */ + public function destroy($Entity$ $entity) { + $entity->delete(); + + return redirect() + ->back() + ->with('success', trans('$module$.$module.successfullyDeleted')); + } +} \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Http/Requests/Create$Entity$.stub b/app/CMS/Modules/Stubs/Http/Requests/Create$Entity$.stub new file mode 100644 index 00000000..f79dcc59 --- /dev/null +++ b/app/CMS/Modules/Stubs/Http/Requests/Create$Entity$.stub @@ -0,0 +1,11 @@ + \LaravelLocalization::setLocale() . '/admin/$module$', + 'middleware' => ['admin'], + 'namespace' => 'Modules\$Module$\Http\Controllers\Admin' + ], function () { + Route::get('/', '$Module$@index') + ->name('$module$.overview'); + + Route::get('/new', '$Module$@create') + ->name('$module$.new'); + + Route::post('/new', '$Module$@store') + ->name('$module$.postNew'); + + Route::get('/edit/{id}', '$Module$@edit') + ->name('$module$.edit'); + + Route::post('/edit/{id}', '$Module$@update') + ->name('$module$.postEdit'); + + Route::get('/delete/{id}', '$Module$@delete') + ->name('$module$.delete'); +}); \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Providers/$Module$ServiceProvider.stub b/app/CMS/Modules/Stubs/Providers/$Module$ServiceProvider.stub new file mode 100644 index 00000000..929857ea --- /dev/null +++ b/app/CMS/Modules/Stubs/Providers/$Module$ServiceProvider.stub @@ -0,0 +1,31 @@ +alias = strtolower('$module$'); + } + + /** + * Set path to module + */ + protected function setModulePath() + { + $this->path = __DIR__; + } +} \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Repositories/$Module$Repository.stub b/app/CMS/Modules/Stubs/Repositories/$Module$Repository.stub new file mode 100644 index 00000000..eabe2362 --- /dev/null +++ b/app/CMS/Modules/Stubs/Repositories/$Module$Repository.stub @@ -0,0 +1,24 @@ +update($data); + } +} \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Resources/lang/cs/$module$.stub b/app/CMS/Modules/Stubs/Resources/lang/cs/$module$.stub new file mode 100644 index 00000000..18238f41 --- /dev/null +++ b/app/CMS/Modules/Stubs/Resources/lang/cs/$module$.stub @@ -0,0 +1,13 @@ + '$Module$', + 'new' => 'Vytvořit nový', + 'description' => '', + 'successfullyUpdated' => 'Úspěšně upraveno.', + 'successfullyCreated' => 'Úspěšně vytvořeno.', + 'successfullyDeleted' => 'Úspěšně smazáno.', + 'overview' => 'Přehled', + 'noItems' => 'Žádná data.', + 'save' => 'Uložit' +]; \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Resources/views/admin/create.blade.stub b/app/CMS/Modules/Stubs/Resources/views/admin/create.blade.stub new file mode 100644 index 00000000..e7d1aa6f --- /dev/null +++ b/app/CMS/Modules/Stubs/Resources/views/admin/create.blade.stub @@ -0,0 +1,7 @@ +@extends('admin.layoutWithNavigation') + +@section('pageHeading', @trans('$module$::$module$.name')) + +@section('content') + @include('$module$::admin/form', ['action' => route('$module$.new')]) +@endsection \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Resources/views/admin/edit.blade.stub b/app/CMS/Modules/Stubs/Resources/views/admin/edit.blade.stub new file mode 100644 index 00000000..6b8bd1ff --- /dev/null +++ b/app/CMS/Modules/Stubs/Resources/views/admin/edit.blade.stub @@ -0,0 +1,7 @@ +@extends('admin.layoutWithNavigation') + +@section('pageHeading', @trans('$module$::$module$.name')) + +@section('content') + @include('$module$::admin/form', ['action' => route('$module$.update')]) +@endsection \ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Resources/views/admin/form.blade.stub b/app/CMS/Modules/Stubs/Resources/views/admin/form.blade.stub new file mode 100644 index 00000000..f422b7d9 --- /dev/null +++ b/app/CMS/Modules/Stubs/Resources/views/admin/form.blade.stub @@ -0,0 +1,6 @@ +
+ + {{--...--}} + + +
\ No newline at end of file diff --git a/app/CMS/Modules/Stubs/Resources/views/admin/index.blade.stub b/app/CMS/Modules/Stubs/Resources/views/admin/index.blade.stub new file mode 100644 index 00000000..817e62e0 --- /dev/null +++ b/app/CMS/Modules/Stubs/Resources/views/admin/index.blade.stub @@ -0,0 +1,17 @@ +@extends('admin.layoutWithNavigation') + +@section('pageHeading', @trans('$module$::$module$.overview')) + +@section('content') + @if (!empty($items)) + + @foreach($items as $item) + + @endforeach +
+ @else +
+ @trans('$module$::$module$.noItems') +
+ @endif +@endsection \ No newline at end of file diff --git a/app/Console/Commands/Modules/CreateNew.php b/app/Console/Commands/Modules/CreateNew.php new file mode 100644 index 00000000..9d27384f --- /dev/null +++ b/app/Console/Commands/Modules/CreateNew.php @@ -0,0 +1,116 @@ +loadArguments(); + $path = preg_replace('|/{2,}|i', '/', config('modules.paths.modules') . '/' . $this->moduleNamespace); + + if (is_dir($path)) { + $this->error('Module already exists in ' . $path); + return; + } + + // copy stub files + \File::copyDirectory(config('modules.paths.stubs'), $path); + + $files = \File::allFiles($path); + foreach ($files as $file) { + $newName = str_replace('stub', 'php', $this->replacePlaceholders($file->getPathname())); + + // ignore new entity when using existing entity + if ($this->entityNamespace != $defaultEntityNamespace && Str::contains('Entities', $file)) { + \File::delete($file); + continue; + } + + // rename file + \File::move($file, $newName); + + // change its content + $content = file_get_contents($newName); + $content = $this->replacePlaceholders($content); + file_put_contents($newName, $content); + } + + $this->info('Module successfully created.'); + } + + /** + * Find and replace all placeholders in given content + * + * @param $content + * + * @return mixed + */ + private function replacePlaceholders($content) + { + $replace = [ + '$Module$' => $this->moduleName, + '$ModuleNamespace$' => str_replace('/', '\\', $this->moduleNamespace), + '$module$' => strtolower($this->moduleName), + '$EntityNamespace$' => $this->entityNamespace, + '$Entity$' => $this->entity + ]; + + foreach ($replace as $what => $for) { + $content = str_replace($what, $for, $content); + } + + return $content; + } + + /** + * Load command arguments + * @return string + */ + private function loadArguments() + { + $parent = $this->argument('parentModule'); + $this->moduleName = $moduleName = $this->argument('name'); + $this->moduleNamespace = trim($parent . '/' . $moduleName, '/'); + + $entity = $this->option('entity'); + + $defaultEntityNamespace = '\\Modules\\' . str_replace('/', '\\', $this->moduleNamespace) . '\Entities\\'; + + if (!empty($entity)) { + $parts = explode('\\', $entity); + $this->entity = $parts[count($parts) - 1]; + unset($parts[count($parts) - 1]); + $this->entityNamespace = implode('\\', $parts); + } else { + $this->entityNamespace = $defaultEntityNamespace; + $this->entity = $this->moduleName; + } + + return $defaultEntityNamespace; + } +} \ No newline at end of file diff --git a/app/Console/Commands/InstallAllModules.php b/app/Console/Commands/Modules/InstallAllModules.php similarity index 75% rename from app/Console/Commands/InstallAllModules.php rename to app/Console/Commands/Modules/InstallAllModules.php index 50f53ac7..36e0f7e2 100644 --- a/app/Console/Commands/InstallAllModules.php +++ b/app/Console/Commands/Modules/InstallAllModules.php @@ -1,6 +1,6 @@ call('install-module', ['name' => $moduleName]); + $this->call('module:install', ['name' => $moduleName]); } catch (\Exception $e) { $this->line('Module ' . $moduleName . ' already installed.'); } diff --git a/app/Console/Commands/InstallModule.php b/app/Console/Commands/Modules/InstallModule.php similarity index 94% rename from app/Console/Commands/InstallModule.php rename to app/Console/Commands/Modules/InstallModule.php index 5bf435e5..79348f6d 100644 --- a/app/Console/Commands/InstallModule.php +++ b/app/Console/Commands/Modules/InstallModule.php @@ -1,8 +1,9 @@ $this->moduleName, 'providers' => $providers, - 'aliases' => isset($config['aliases']) ? $config['aliases'] : [], 'order' => isset($config['order']) ? $config['order'] : 0, 'files' => isset($config['files']) ? $config['files'] : [] ]; - $module = Module::install($name, $alias, $description, $handler, $this->parentModuleId, $settings); + $module = Installer::install($name, $alias, $description, $handler, $this->parentModuleId, $settings); } // try to install submodules @@ -184,7 +184,7 @@ class InstallModule extends Command $submodule = str_replace($this->modulesPath . DIRECTORY_SEPARATOR, '', $submodulePath); try { - $this->call('install-module', ['name' => $submodule, 'parentModuleId' => $parentModule->id]); + $this->call('module:install', ['name' => $submodule, 'parentModuleId' => $parentModule->id]); } catch (\Exception $e) { $this->error($e->getMessage()); } diff --git a/app/Console/Commands/SetTemplate.php b/app/Console/Commands/SetTemplate.php index f24c2a7b..2b7cca26 100644 --- a/app/Console/Commands/SetTemplate.php +++ b/app/Console/Commands/SetTemplate.php @@ -3,6 +3,8 @@ namespace App\Console\Commands; use App\Models\Module; +use App\ModuleManager\Installer; +use App\ModuleManager\Uninstaller; use Illuminate\Console\Command; use Illuminate\Support\Facades\Cache; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; @@ -43,14 +45,13 @@ class SetTemplate extends Command $config['staticName'] = $template; if ($current) { - $info = json_decode($current->module_settings); - - $this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $info->staticName . '.'); + $this->line('Template is already installed. Currently using template ' . trans($current->name) . ' located in /templates/' . $current->module_settings['staticName'] . '.'); $confirm = $this->confirm('Uninstall it and install *' . trans($config['name']) . '*? All data associated with installed template will be lost!'); if ($confirm) { $this->line('Uninstalling ' . $current->name . '.'); - $current->uninstall(); + + Uninstaller::uninstall($current); } else { $this->line('Aborting installation.'); return; @@ -58,7 +59,7 @@ class SetTemplate extends Command } try { - Module::install($config['name'], $config['alias'], $config['description'], $config['handler'], false, $config); + Installer::install($config['name'], $config['alias'], $config['description'], $config['handler'], false, $config); } catch (\Exception $e) { $this->error('Cannot install template ' . $template . '. Message: ' . $e->getMessage()); return; @@ -72,6 +73,8 @@ class SetTemplate extends Command // run again artisan for publishing resources // it cannot be done using $this->call, because we need to load different template into service providers - exec('php artisan vendor:publish'); + if ($publish) { + exec('php artisan vendor:publish'); + } } } diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 00cf4923..19c2c898 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -2,6 +2,7 @@ namespace App\Console; +use App\Console\Commands\Modules\CreateNew; use App\Console\Commands\PublishTemplateResources; use App\Console\Commands\TemplateInfo; use Illuminate\Console\Scheduling\Schedule; @@ -17,8 +18,9 @@ class Kernel extends ConsoleKernel protected $commands = [ Commands\NewUser::class, Commands\ChangePassword::class, - Commands\InstallModule::class, - Commands\InstallAllModules::class, + CreateNew::class, + Commands\Modules\InstallModule::class, + Commands\Modules\InstallAllModules::class, Commands\TranslateDirectory::class, Commands\TranslateAll::class, Commands\InitDatabaseSchema::class, @@ -37,7 +39,5 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule) { - // $schedule->command('inspire') - // ->hourly(); } } diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 4c01a2dd..df72fc27 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -23,7 +23,7 @@ class Controller extends BaseController * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ - public static function VisitorsView($template, $data = [], $mergeData = []) + public static function visitorsView($template, $data = [], $mergeData = []) { $view = Template::name($template); diff --git a/app/Http/Controllers/Visitor/ContentPage.php b/app/Http/Controllers/Visitor/ContentPage.php index 6610bb50..81635ee0 100644 --- a/app/Http/Controllers/Visitor/ContentPage.php +++ b/app/Http/Controllers/Visitor/ContentPage.php @@ -65,7 +65,7 @@ class ContentPage extends Controller $displayPipeline = app('displayPipeline'); $page = $displayPipeline->run($page); - return Controller::VisitorsView($page->template, ['page' => $page]); + return Controller::visitorsView($page->template, ['page' => $page]); } } diff --git a/app/Models/Module.php b/app/Models/Module.php index f6940aad..47db16c3 100644 --- a/app/Models/Module.php +++ b/app/Models/Module.php @@ -9,7 +9,6 @@ use Illuminate\Database\Eloquent\Model; */ class Module extends Model { - use ModelTraits\Module; public $timestamps = false; protected $fillable = [ 'handler', @@ -23,4 +22,9 @@ class Module extends Model 'manages_content', 'is_template' ]; + protected $casts = [ + 'module_settings' => 'array', + 'is_template' => 'boolean', + 'has_submodules' => 'boolean' + ]; } \ No newline at end of file diff --git a/app/ModuleManager/Config/modules.php b/app/ModuleManager/Config/modules.php new file mode 100644 index 00000000..529abbaf --- /dev/null +++ b/app/ModuleManager/Config/modules.php @@ -0,0 +1,10 @@ + 'Modules', + 'paths' => [ + 'modules' => base_path('modules'), + 'assets' => public_path('modules'), + 'stubs' => base_path('app/CMS/Modules/Stubs'), + ] +]; diff --git a/app/Models/ModelTraits/Module.php b/app/ModuleManager/Installer.php similarity index 56% rename from app/Models/ModelTraits/Module.php rename to app/ModuleManager/Installer.php index a60cfd61..2d8f4add 100644 --- a/app/Models/ModelTraits/Module.php +++ b/app/ModuleManager/Installer.php @@ -1,14 +1,12 @@ has_submodules = true; $parentModule->save(); } // insert module into database - $module = ModuleModel::create([ + $module = Module::create([ 'name' => $name, 'description' => $description, 'handler' => $handler, 'manages_content' => $managesContent, 'support_categories' => $supportCategories, 'alias' => $alias, - 'module_settings' => json_encode($settings), + 'module_settings' => $settings, 'parent_id' => $parentModuleId ? $parentModuleId : null, 'enabled' => 1, 'is_template' => $isTemplate @@ -60,54 +58,4 @@ trait Module return $module; } - - /** - * Delete module from database and uninstall its dependencies - * - * @throws \ErrorException - */ - public function uninstall() - { - // check if user does not want to install module in runtime - if (!App::runningInConsole()) { - throw new \ErrorException('Modules can be uninstalled only via Artisan!'); - } - - // delete everything in /resources/views/visitor - if ($this->is_template) { - $this->deleteDirectory(resource_path('views/visitor')); - $this->deleteDirectory(resource_path('views/modules')); - $this->deleteDirectory(public_path('assets')); - - // delete all template paths - TemplatePath::getQuery() - ->delete(); - } - - if ($this->handler && is_callable([$this->handler, 'uninstall'])) { - call_user_func([$this->handler, 'uninstall'], $this); - } - - $this->delete(); - } - - /** - * Delete directory when uninstalling module. - * - * @param $directory - * - * @throws \ErrorException - */ - private function deleteDirectory($directory) - { - if (!is_dir($directory)) { - return; - } - - $success = \File::deleteDirectory($directory, true); - - if (!$success) { - throw new \ErrorException('Cannot delete ' . $directory); - } - } } \ No newline at end of file diff --git a/app/ModuleManager/Providers/ModuleManager.php b/app/ModuleManager/Providers/ModuleManager.php new file mode 100644 index 00000000..199d0a83 --- /dev/null +++ b/app/ModuleManager/Providers/ModuleManager.php @@ -0,0 +1,48 @@ +where('is_template', false) + ->get(); + }); + + // iterate over all modules and enable or disable them + foreach ($modules as $module) { + if (isset($module->module_settings['providers']) && !empty($module->module_settings['providers'])) { + foreach ($module->module_settings['providers'] as $provider) { + $this->app->register($provider); + } + } + + // include files (if any) + if (isset($module->module_settings['files']) && !empty($module->module_settings['files'])) { + foreach ($module->module_settings['files'] as $file) { + include config('modules.paths.modules') . '/' . $module->module_settings['staticName'] . '/' . $file; + } + } + } + } + + /** + * Register the application services. + * @return void + */ + public function register() + { + } +} diff --git a/app/ModuleManager/Uninstaller.php b/app/ModuleManager/Uninstaller.php new file mode 100644 index 00000000..8cc49f3a --- /dev/null +++ b/app/ModuleManager/Uninstaller.php @@ -0,0 +1,60 @@ +is_template) { + self::deleteDirectory(resource_path('views/visitor')); + self::deleteDirectory(resource_path('views/modules')); + self::deleteDirectory(public_path('assets')); + + // delete all template paths + TemplatePath::getQuery() + ->delete(); + } + + if ($module->handler && is_callable([$module->handler, 'uninstall'])) { + call_user_func([$module->handler, 'uninstall'], $module); + } + + $module->delete(); + } + + /** + * Delete directory when uninstalling module. + * + * @param $directory + * + * @throws \ErrorException + */ + private static function deleteDirectory($directory) + { + if (!is_dir($directory)) { + return; + } + + $success = \File::deleteDirectory($directory, true); + + if (!$success) { + throw new \ErrorException('Cannot delete ' . $directory); + } + } +} diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index e25b2de4..e73c9b40 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -64,13 +64,12 @@ class AppServiceProvider extends ServiceProvider } // register PingPong module extension - $this->app->register(ModulesServiceProvider::class); $this->app->register(MenusServiceProvider::class); $this->app->register(LaravelLocalizationServiceProvider::class); // create singletons for registering widgets $this->app->singleton('registerWidget', function ($app) { - return new WidgetRegistrator($app); + return new WidgetRegistrator(); }); // create singleton for display pipeline - pipeline used for displaying visitor pages @@ -85,7 +84,7 @@ class AppServiceProvider extends ServiceProvider // create registrator for template directories $this->app->singleton('registerTemplateDir', function ($app) { - return new TemplateRegistrator($app); + return new TemplateRegistrator(); }); $this->app->singleton('registerSettingsExtension', function ($app) { diff --git a/app/Providers/ModuleManager.php b/app/Providers/ModuleManager.php deleted file mode 100644 index 5594544f..00000000 --- a/app/Providers/ModuleManager.php +++ /dev/null @@ -1,93 +0,0 @@ -get(); - - foreach ($modules as $module) { - $module->module_settings = json_decode($module->module_settings); - } - - return $modules; - }); - - // iterate over all modules and enable or disable them - foreach ($modules as $module) { - if ($module->is_template) { - if (isset($module->module_settings->providers) && !empty($module->module_settings->providers)) { - foreach ($module->module_settings->providers as $provider) { - $this->app->register($provider); - } - } - - continue; - } - - $this->createModulesJson($module); - } - } - - /** - * Register the application services. - * @return void - */ - public function register() - { - } - - /** - * Read config file and merge it with module config in database. - * This method REQUIRES published config of given module (otherwise config(modulename) is not available)! - * - * @param Module $module - * - * @throws \ErrorException when module.json is not writable - */ - private function createModulesJson(Module $module) - { - $config = $module->module_settings; - - if (is_null($config)) { - return; - } - - // path to module.json - $path = config('modules.paths.modules') . DIRECTORY_SEPARATOR . $config->staticName . DIRECTORY_SEPARATOR . 'module.json'; - - // check if module config is writable - if (!is_writable(dirname($path))) { - Log::warning('Cannot write to ' . $path); - return; - } - - // set enabled/disabled status for this module - $data = new \stdClass(); - $data->name = $config->staticName; - $data->description = $module->description; - $data->alias = $module->alias; - $data->providers = $config->providers; - $data->aliases = $config->aliases; - $data->order = $config->order; - $data->files = $config->files; - $data->active = $module->enabled; - - // create file - file_put_contents($path, json_encode($data)); - } -} diff --git a/app/Providers/SubmodulesManager.php b/app/Providers/SubmodulesManager.php deleted file mode 100644 index ee8bbe77..00000000 --- a/app/Providers/SubmodulesManager.php +++ /dev/null @@ -1,64 +0,0 @@ -getPath(); - $config = new Json($modulePath . DIRECTORY_SEPARATOR . 'module.json'); - - // Does this module specify any providers? If not, consider this module with submodules and register them - if ($config->get('providers')) { - continue; - } - - $submodules = \File::directories($modulePath); - - foreach ($submodules as $submodulePath) { - try { - $config = new Json($submodulePath . DIRECTORY_SEPARATOR . 'module.json'); - - if (!$config->get('active')) { - continue; - } - - $serviceProviders = $config->get('providers', []); - foreach ($serviceProviders as $serviceProvider) { - $this->app->register($serviceProvider); - } - - $initFiles = $config->get('files', []); - - foreach ($initFiles as $file) { - require $submodulePath . DIRECTORY_SEPARATOR . $file; - } - } catch (FileNotFoundException $e) { - // ignore missing module and do not register this submodule - } - } - } - } - - /** - * Register the service provider. - * - * @return void - */ - public function register() - { - } -} \ No newline at end of file diff --git a/app/Providers/TemplateServiceProvider.php b/app/Providers/TemplateServiceProvider.php index 6c30bf40..08f4a04a 100644 --- a/app/Providers/TemplateServiceProvider.php +++ b/app/Providers/TemplateServiceProvider.php @@ -94,7 +94,7 @@ class TemplateServiceProvider extends ServiceProvider return; } - $templateDir = base_path('templates/' . $template->module_settings->staticName . '/Resources'); + $templateDir = base_path('templates/' . $template->module_settings['staticName']. '/Resources'); $assetsDir = $templateDir . '/' . TemplateContract::ASSETS_DIRECTORY; $viewsDir = $templateDir . '/views'; diff --git a/composer.json b/composer.json index 8d81e4f2..e1662924 100644 --- a/composer.json +++ b/composer.json @@ -8,8 +8,7 @@ "type": "project", "require": { "php": ">=5.5.9", - "laravel/framework": "5.2.*", - "pingpong/modules": "~2.0", + "laravel/framework": "5.4.*", "pingpong/menus": "^2.2", "watson/sitemap": "^2.0", "mcamara/laravel-localization": "^1.1", @@ -24,7 +23,6 @@ "phpunit/phpunit": "~4.0", "symfony/css-selector": "2.8.*|3.0.*", "symfony/dom-crawler": "2.8.*|3.0.*", - "ignasbernotas/laravel-model-generator": "^1.0", "barryvdh/laravel-debugbar": "^2.1" }, "autoload": { diff --git a/composer.lock b/composer.lock index 8c49209e..bb9b8e72 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "content-hash": "b986e3e1805bf5cb028c24818beeb9a4", + "content-hash": "5200af34a5cccff8ef7f973506ea0704", "packages": [ { "name": "classpreloader/classpreloader", @@ -93,354 +93,6 @@ "description": "implementation of xdg base directory specification for php", "time": "2014-10-24T07:27:01+00:00" }, - { - "name": "doctrine/annotations", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/annotations.git", - "reference": "f9cf50745a45cae4a55f35e7691d124c4d887e45" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/annotations/zipball/f9cf50745a45cae4a55f35e7691d124c4d887e45", - "reference": "f9cf50745a45cae4a55f35e7691d124c4d887e45", - "shasum": "" - }, - "require": { - "doctrine/lexer": "1.*", - "php": ">=5.3.2" - }, - "require-dev": { - "doctrine/cache": "1.*", - "phpunit/phpunit": "4.*" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Annotations\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Docblock Annotations Parser", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "docblock", - "parser" - ], - "time": "2016-08-31T09:31:57+00:00" - }, - { - "name": "doctrine/cache", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/cache.git", - "reference": "fe68e4f78804684e31cce17590b0bd9f088db1b0" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/cache/zipball/fe68e4f78804684e31cce17590b0bd9f088db1b0", - "reference": "fe68e4f78804684e31cce17590b0bd9f088db1b0", - "shasum": "" - }, - "require": { - "php": "~5.5|~7.0" - }, - "conflict": { - "doctrine/common": ">2.2,<2.4" - }, - "require-dev": { - "phpunit/phpunit": "~4.8|~5.0", - "predis/predis": "~1.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Caching library offering an object-oriented API for many cache backends", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "cache", - "caching" - ], - "time": "2016-07-15T15:57:08+00:00" - }, - { - "name": "doctrine/collections", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/collections.git", - "reference": "2dfc898f2a66c192d6a195bdc9c5040f65adfaab" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/collections/zipball/2dfc898f2a66c192d6a195bdc9c5040f65adfaab", - "reference": "2dfc898f2a66c192d6a195bdc9c5040f65adfaab", - "shasum": "" - }, - "require": { - "php": "^5.3.2 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Collections\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Collections Abstraction library", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "array", - "collections", - "iterator" - ], - "time": "2016-09-01T10:39:08+00:00" - }, - { - "name": "doctrine/common", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/common.git", - "reference": "670d814b6c8b5e8f39a2764d090463d39b3502c9" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/common/zipball/670d814b6c8b5e8f39a2764d090463d39b3502c9", - "reference": "670d814b6c8b5e8f39a2764d090463d39b3502c9", - "shasum": "" - }, - "require": { - "doctrine/annotations": "1.*", - "doctrine/cache": "1.*", - "doctrine/collections": "1.*", - "doctrine/inflector": "1.*", - "doctrine/lexer": "1.*", - "php": "~5.6|~7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4.6" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.7.x-dev" - } - }, - "autoload": { - "psr-4": { - "Doctrine\\Common\\": "lib/Doctrine/Common" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Common Library for Doctrine projects", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "annotations", - "collections", - "eventmanager", - "persistence", - "spl" - ], - "time": "2016-07-20T15:39:51+00:00" - }, - { - "name": "doctrine/dbal", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/dbal.git", - "reference": "c446c31130e6db7178e4188f8c12033b2ca3ee4a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/dbal/zipball/c446c31130e6db7178e4188f8c12033b2ca3ee4a", - "reference": "c446c31130e6db7178e4188f8c12033b2ca3ee4a", - "shasum": "" - }, - "require": { - "doctrine/common": "~2.4", - "php": "^5.6 || ^7.0" - }, - "require-dev": { - "phpunit/phpunit": "^5.4.6", - "phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5", - "symfony/console": "2.*||^3.0" - }, - "suggest": { - "symfony/console": "For helpful console commands such as SQL execution and import of files." - }, - "bin": [ - "bin/doctrine-dbal" - ], - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.6.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\DBAL\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Benjamin Eberlei", - "email": "kontakt@beberlei.de" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Jonathan Wage", - "email": "jonwage@gmail.com" - } - ], - "description": "Database Abstraction Layer", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "database", - "dbal", - "persistence", - "queryobject" - ], - "time": "2016-08-25T23:11:10+00:00" - }, { "name": "doctrine/inflector", "version": "dev-master", @@ -508,143 +160,6 @@ ], "time": "2016-05-12T17:23:41+00:00" }, - { - "name": "doctrine/lexer", - "version": "dev-master", - "source": { - "type": "git", - "url": "https://github.com/doctrine/lexer.git", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", - "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", - "shasum": "" - }, - "require": { - "php": ">=5.3.2" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.0.x-dev" - } - }, - "autoload": { - "psr-0": { - "Doctrine\\Common\\Lexer\\": "lib/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Roman Borschel", - "email": "roman@code-factory.org" - }, - { - "name": "Guilherme Blanco", - "email": "guilhermeblanco@gmail.com" - }, - { - "name": "Johannes Schmitt", - "email": "schmittjoh@gmail.com" - } - ], - "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", - "homepage": "http://www.doctrine-project.org", - "keywords": [ - "lexer", - "parser" - ], - "time": "2014-09-09T13:34:57+00:00" - }, - { - "name": "erusev/parsedown", - "version": "1.6.0", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown.git", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", - "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", - "shasum": "" - }, - "type": "library", - "autoload": { - "psr-0": { - "Parsedown": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "Parser for Markdown.", - "homepage": "http://parsedown.org", - "keywords": [ - "markdown", - "parser" - ], - "time": "2015-10-04T16:44:32+00:00" - }, - { - "name": "erusev/parsedown-extra", - "version": "0.7.1", - "source": { - "type": "git", - "url": "https://github.com/erusev/parsedown-extra.git", - "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c", - "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c", - "shasum": "" - }, - "require": { - "erusev/parsedown": "~1.4" - }, - "type": "library", - "autoload": { - "psr-0": { - "ParsedownExtra": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Emanuil Rusev", - "email": "hello@erusev.com", - "homepage": "http://erusev.com" - } - ], - "description": "An extension of Parsedown that adds support for Markdown Extra.", - "homepage": "https://github.com/erusev/parsedown-extra", - "keywords": [ - "markdown", - "markdown extra", - "parsedown", - "parser" - ], - "time": "2015-11-01T10:19:22+00:00" - }, { "name": "franzose/closure-table", "version": "4.1.4", @@ -1616,55 +1131,6 @@ ], "time": "2016-04-03T05:47:09+00:00" }, - { - "name": "pingpong/generators", - "version": "2.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/pingpong-labs/generators.git", - "reference": "7649e2dfa7d9b66a649696a83959e2d68f8d6073" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pingpong-labs/generators/zipball/7649e2dfa7d9b66a649696a83959e2d68f8d6073", - "reference": "7649e2dfa7d9b66a649696a83959e2d68f8d6073", - "shasum": "" - }, - "require": { - "doctrine/dbal": "~2.5", - "illuminate/filesystem": "5.2.*", - "illuminate/support": "5.2.*", - "php": ">=5.4.0", - "pingpong/support": "2.2.*@dev" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpunit/phpunit": "~4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Pingpong\\Generators\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pingpong Labs", - "email": "pingpong.labs@gmail.com" - } - ], - "description": "Laravel Generators", - "keywords": [ - "generators", - "laravel", - "pingpong" - ], - "time": "2016-02-26T04:53:40+00:00" - }, { "name": "pingpong/menus", "version": "2.2.x-dev", @@ -1717,99 +1183,6 @@ ], "time": "2016-08-23T05:51:55+00:00" }, - { - "name": "pingpong/modules", - "version": "2.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/pingpong-labs/modules.git", - "reference": "8ee9dfcc49e56173a26b3cfdc46b6037a1400a5a" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pingpong-labs/modules/zipball/8ee9dfcc49e56173a26b3cfdc46b6037a1400a5a", - "reference": "8ee9dfcc49e56173a26b3cfdc46b6037a1400a5a", - "shasum": "" - }, - "require": { - "laravel/framework": "5.2.*", - "laravelcollective/html": "~5.0", - "php": ">=5.4.0", - "pingpong/generators": "2.2.*", - "pingpong/support": "2.2.*" - }, - "require-dev": { - "mockery/mockery": "~0.9", - "phpunit/phpunit": "~4" - }, - "type": "library", - "autoload": { - "psr-4": { - "Pingpong\\Modules\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pingpong Labs", - "email": "pingpong.labs@gmail.com" - } - ], - "description": "Laravel Modules", - "keywords": [ - "hmvc", - "laravel", - "module", - "modules", - "pingpong" - ], - "time": "2016-01-29T04:39:40+00:00" - }, - { - "name": "pingpong/support", - "version": "2.2.x-dev", - "source": { - "type": "git", - "url": "https://github.com/pingpong-labs/support.git", - "reference": "2b4ada3e8071da1b39152cfb6a2df86f053d8bb6" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/pingpong-labs/support/zipball/2b4ada3e8071da1b39152cfb6a2df86f053d8bb6", - "reference": "2b4ada3e8071da1b39152cfb6a2df86f053d8bb6", - "shasum": "" - }, - "require": { - "erusev/parsedown-extra": "0.7.*", - "illuminate/filesystem": "5.2.*", - "illuminate/support": "5.2.*", - "php": ">=5.4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Pingpong\\Support\\": "" - }, - "files": [ - "helpers.php" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "BSD-3-Clause" - ], - "authors": [ - { - "name": "Pingpong Labs", - "email": "pingpong.labs@gmail.com" - } - ], - "description": "Support Component of Pingpong Sky Package", - "time": "2016-01-07T08:23:04+00:00" - }, { "name": "psr/http-message", "version": "dev-master", @@ -3024,6 +2397,354 @@ ], "time": "2016-08-25T20:55:54+00:00" }, + { + "name": "doctrine/annotations", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "f9cf50745a45cae4a55f35e7691d124c4d887e45" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/f9cf50745a45cae4a55f35e7691d124c4d887e45", + "reference": "f9cf50745a45cae4a55f35e7691d124c4d887e45", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": ">=5.3.2" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "4.*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Annotations\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2016-08-31T09:31:57+00:00" + }, + { + "name": "doctrine/cache", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/cache.git", + "reference": "fe68e4f78804684e31cce17590b0bd9f088db1b0" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/cache/zipball/fe68e4f78804684e31cce17590b0bd9f088db1b0", + "reference": "fe68e4f78804684e31cce17590b0bd9f088db1b0", + "shasum": "" + }, + "require": { + "php": "~5.5|~7.0" + }, + "conflict": { + "doctrine/common": ">2.2,<2.4" + }, + "require-dev": { + "phpunit/phpunit": "~4.8|~5.0", + "predis/predis": "~1.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Caching library offering an object-oriented API for many cache backends", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "cache", + "caching" + ], + "time": "2016-07-15T15:57:08+00:00" + }, + { + "name": "doctrine/collections", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/collections.git", + "reference": "2dfc898f2a66c192d6a195bdc9c5040f65adfaab" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/collections/zipball/2dfc898f2a66c192d6a195bdc9c5040f65adfaab", + "reference": "2dfc898f2a66c192d6a195bdc9c5040f65adfaab", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.3.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Collections\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Collections Abstraction library", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "array", + "collections", + "iterator" + ], + "time": "2016-09-01T10:39:08+00:00" + }, + { + "name": "doctrine/common", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/common.git", + "reference": "670d814b6c8b5e8f39a2764d090463d39b3502c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/common/zipball/670d814b6c8b5e8f39a2764d090463d39b3502c9", + "reference": "670d814b6c8b5e8f39a2764d090463d39b3502c9", + "shasum": "" + }, + "require": { + "doctrine/annotations": "1.*", + "doctrine/cache": "1.*", + "doctrine/collections": "1.*", + "doctrine/inflector": "1.*", + "doctrine/lexer": "1.*", + "php": "~5.6|~7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4.6" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.7.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\": "lib/Doctrine/Common" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Common Library for Doctrine projects", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "collections", + "eventmanager", + "persistence", + "spl" + ], + "time": "2016-07-20T15:39:51+00:00" + }, + { + "name": "doctrine/dbal", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/dbal.git", + "reference": "c446c31130e6db7178e4188f8c12033b2ca3ee4a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/dbal/zipball/c446c31130e6db7178e4188f8c12033b2ca3ee4a", + "reference": "c446c31130e6db7178e4188f8c12033b2ca3ee4a", + "shasum": "" + }, + "require": { + "doctrine/common": "~2.4", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.4.6", + "phpunit/phpunit-mock-objects": "!=3.2.4,!=3.2.5", + "symfony/console": "2.*||^3.0" + }, + "suggest": { + "symfony/console": "For helpful console commands such as SQL execution and import of files." + }, + "bin": [ + "bin/doctrine-dbal" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.6.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\DBAL\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + } + ], + "description": "Database Abstraction Layer", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "database", + "dbal", + "persistence", + "queryobject" + ], + "time": "2016-08-25T23:11:10+00:00" + }, { "name": "doctrine/instantiator", "version": "dev-master", @@ -3078,6 +2799,143 @@ ], "time": "2016-03-31T10:24:22+00:00" }, + { + "name": "doctrine/lexer", + "version": "dev-master", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09T13:34:57+00:00" + }, + { + "name": "erusev/parsedown", + "version": "1.6.0", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown.git", + "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown/zipball/3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "reference": "3ebbd730b5c2cf5ce78bc1bf64071407fc6674b7", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-0": { + "Parsedown": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "Parser for Markdown.", + "homepage": "http://parsedown.org", + "keywords": [ + "markdown", + "parser" + ], + "time": "2015-10-04T16:44:32+00:00" + }, + { + "name": "erusev/parsedown-extra", + "version": "0.7.1", + "source": { + "type": "git", + "url": "https://github.com/erusev/parsedown-extra.git", + "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/erusev/parsedown-extra/zipball/0db5cce7354e4b76f155d092ab5eb3981c21258c", + "reference": "0db5cce7354e4b76f155d092ab5eb3981c21258c", + "shasum": "" + }, + "require": { + "erusev/parsedown": "~1.4" + }, + "type": "library", + "autoload": { + "psr-0": { + "ParsedownExtra": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Emanuil Rusev", + "email": "hello@erusev.com", + "homepage": "http://erusev.com" + } + ], + "description": "An extension of Parsedown that adds support for Markdown Extra.", + "homepage": "https://github.com/erusev/parsedown-extra", + "keywords": [ + "markdown", + "markdown extra", + "parsedown", + "parser" + ], + "time": "2015-11-01T10:19:22+00:00" + }, { "name": "fzaninotto/faker", "version": "dev-master", @@ -3179,49 +3037,6 @@ ], "time": "2016-01-19T12:08:55+00:00" }, - { - "name": "ignasbernotas/laravel-model-generator", - "version": "1.1.4", - "source": { - "type": "git", - "url": "https://github.com/ignasbernotas/laravel-model-generator.git", - "reference": "343ad81e5ec64b224aff01e7054e98faf98f1c61" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/ignasbernotas/laravel-model-generator/zipball/343ad81e5ec64b224aff01e7054e98faf98f1c61", - "reference": "343ad81e5ec64b224aff01e7054e98faf98f1c61", - "shasum": "" - }, - "require": { - "illuminate/support": "~5.0", - "php": ">=5.4.0" - }, - "type": "library", - "autoload": { - "psr-4": { - "Iber\\Generator\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Ignas Bernotas", - "email": "ignas@iber.lt" - } - ], - "description": "Laravel 5 model generator from existing schema", - "keywords": [ - "generator", - "laravel", - "model", - "schema" - ], - "time": "2016-05-24T16:57:40+00:00" - }, { "name": "maximebf/debugbar", "version": "dev-master", @@ -3288,12 +3103,12 @@ "version": "0.9.x-dev", "source": { "type": "git", - "url": "https://github.com/padraic/mockery.git", + "url": "https://github.com/mockery/mockery.git", "reference": "dc369985a60578ca38f3525e98c1038f84153bc6" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/padraic/mockery/zipball/dc369985a60578ca38f3525e98c1038f84153bc6", + "url": "https://api.github.com/repos/mockery/mockery/zipball/dc369985a60578ca38f3525e98c1038f84153bc6", "reference": "dc369985a60578ca38f3525e98c1038f84153bc6", "shasum": "" }, @@ -3927,6 +3742,97 @@ ], "time": "2015-10-02T06:51:40+00:00" }, + { + "name": "pingpong/generators", + "version": "2.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/pingpong-labs/generators.git", + "reference": "7649e2dfa7d9b66a649696a83959e2d68f8d6073" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pingpong-labs/generators/zipball/7649e2dfa7d9b66a649696a83959e2d68f8d6073", + "reference": "7649e2dfa7d9b66a649696a83959e2d68f8d6073", + "shasum": "" + }, + "require": { + "doctrine/dbal": "~2.5", + "illuminate/filesystem": "5.2.*", + "illuminate/support": "5.2.*", + "php": ">=5.4.0", + "pingpong/support": "2.2.*@dev" + }, + "require-dev": { + "mockery/mockery": "~0.9", + "phpunit/phpunit": "~4" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pingpong\\Generators\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pingpong Labs", + "email": "pingpong.labs@gmail.com" + } + ], + "description": "Laravel Generators", + "keywords": [ + "generators", + "laravel", + "pingpong" + ], + "time": "2016-02-26T04:53:40+00:00" + }, + { + "name": "pingpong/support", + "version": "2.2.x-dev", + "source": { + "type": "git", + "url": "https://github.com/pingpong-labs/support.git", + "reference": "2b4ada3e8071da1b39152cfb6a2df86f053d8bb6" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/pingpong-labs/support/zipball/2b4ada3e8071da1b39152cfb6a2df86f053d8bb6", + "reference": "2b4ada3e8071da1b39152cfb6a2df86f053d8bb6", + "shasum": "" + }, + "require": { + "erusev/parsedown-extra": "0.7.*", + "illuminate/filesystem": "5.2.*", + "illuminate/support": "5.2.*", + "php": ">=5.4.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Pingpong\\Support\\": "" + }, + "files": [ + "helpers.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Pingpong Labs", + "email": "pingpong.labs@gmail.com" + } + ], + "description": "Support Component of Pingpong Sky Package", + "time": "2016-01-07T08:23:04+00:00" + }, { "name": "sebastian/comparator", "version": "dev-master", diff --git a/config/app.php b/config/app.php index c27f6e58..23f3d02f 100644 --- a/config/app.php +++ b/config/app.php @@ -154,11 +154,8 @@ return [ Illuminate\Validation\ValidationServiceProvider::class, Illuminate\View\ViewServiceProvider::class, Mcamara\LaravelLocalization\LaravelLocalizationServiceProvider::class, - // this class must be before ModulesServiceProvider from PingPong, because it handles files module.json - App\Providers\ModuleManager::class, - Pingpong\Modules\ModulesServiceProvider::class, + \App\ModuleManager\Providers\ModuleManager::class, Pingpong\Menus\MenusServiceProvider::class, - App\Providers\SubmodulesManager::class, Franzose\ClosureTable\ClosureTableServiceProvider::class, \Watson\Sitemap\SitemapServiceProvider::class, Intervention\Image\ImageServiceProvider::class, @@ -206,7 +203,6 @@ return [ 'Log' => Illuminate\Support\Facades\Log::class, 'Mail' => Illuminate\Support\Facades\Mail::class, 'Menu' => Pingpong\Menus\MenuFacade::class, - 'Module' => Pingpong\Modules\Facades\Module::class, 'Password' => Illuminate\Support\Facades\Password::class, 'Queue' => Illuminate\Support\Facades\Queue::class, 'Redirect' => Illuminate\Support\Facades\Redirect::class, diff --git a/config/modules.php b/config/modules.php index 80edfbbb..be87f6b5 100644 --- a/config/modules.php +++ b/config/modules.php @@ -1,160 +1,10 @@ '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, - ], - + 'paths' => [ + 'modules' => base_path('modules'), + 'assets' => public_path('modules'), + 'stubs' => base_path('app/ModuleManager/Stubs'), + ] ]; diff --git a/modules/Blog/Article/Providers/ArticleServiceProvider.php b/modules/Blog/Article/Providers/ArticleServiceProvider.php index bae25fe8..77dbcac3 100644 --- a/modules/Blog/Article/Providers/ArticleServiceProvider.php +++ b/modules/Blog/Article/Providers/ArticleServiceProvider.php @@ -1,10 +1,10 @@ get(); // render content - return Controller::VisitorsView($content->template, [ + return Controller::visitorsView($content->template, [ 'images' => $images, 'page' => $content, 'extra' => $parameters diff --git a/modules/Gallery/Providers/GalleryServiceProvider.php b/modules/Gallery/Providers/GalleryServiceProvider.php index aac0bc39..304b3075 100644 --- a/modules/Gallery/Providers/GalleryServiceProvider.php +++ b/modules/Gallery/Providers/GalleryServiceProvider.php @@ -1,8 +1,8 @@