/** * Register the service provider. * * @return void */ public function register() { $this->mergeConfigFrom(static::confPath(), 'press'); $this->app->bindShared('press', function ($app) { //@todo use back laravel config loader $conf = config('press'); $service = new PressService($app, $conf); $service->loadThemes(); return $service; }); $this->app->bindShared('press.index', function ($app) { return new PressIndex(); }); $this->app->bindShared('press.cache', function ($app) { return new PressCache($app->request); }); $this->app->bind('press.seo', config('press.seo_generator')); Paginator::currentPageResolver(function () { return $this->app['request']->route()->parameter('page') ?: $this->app['request']->input('page'); }); }
<?php namespace Lud\Press; use Route; Route::group(['namespace' => 'Lud\\Press'], function ($router) { Route::get('stop-editing', ['uses' => 'PressEditorController@stopEditing', 'as' => 'press.stop_editing']); }); Route::group(['middleware' => 'auth', 'namespace' => 'Lud\\Press'], function ($router) { Route::get('editing', ['uses' => 'PressEditorController@startEditing', 'as' => 'press.editing']); Route::get('refresh', ['uses' => 'PressEditorController@refresh', 'as' => 'press.refresh_page_cache']); Route::get('purge', ['uses' => 'PressEditorController@purge', 'as' => 'press.purge_cache']); }); // We will setup a route for each URL schema defined in the url_map config. We // do not care about file schemas, since once we hit the controller, it handles // the file search from URL foreach (PressFacade::getConf('url_map') as $urlSchema) { $routeURL = PressService::replaceStrParts($urlSchema, function ($key) { return '{' . $key . '}'; }); Route::get($routeURL, ['pressCache' => true, 'uses' => 'Lud\\Press\\PressPubController@publish']); } // exit;