Skip to content

Commit

Permalink
Fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
neochief committed Mar 14, 2018
1 parent 6693014 commit ac0c96f
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.idea
composer.phar
composer.lock
vendor
26 changes: 22 additions & 4 deletions src/JetPagesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ public function boot()
$this->loadMigrationsFrom(__DIR__ . '/resources/migrations');

$this->loadViewsFrom(__DIR__ . '/resources/views', 'sg/jetpages');
view()->composer('*', 'ShvetsGroup\JetPages\ViewComposers\LocaleComposer');
view()->composer('*', 'ShvetsGroup\JetPages\ViewComposers\MenuComposer');
$this->app['view']->composer('*', 'ShvetsGroup\JetPages\ViewComposers\LocaleComposer');
$this->app['view']->composer('*', 'ShvetsGroup\JetPages\ViewComposers\MenuComposer');

$this->publishes([__DIR__ . '/resources/views' => base_path('resources/views/vendor/sg/jetpages')], 'views');

$this->mergeConfigFrom(__DIR__ . '/resources/config/jetpages.php', 'jetpages');
$this->publishes([__DIR__ . '/resources/config/jetpages.php' => config_path('jetpages.php')], 'config');

$this->app['router']->aliasMiddleware('static-cache', StaticCacheMiddleware::class);
Expand All @@ -83,8 +85,24 @@ public function boot()
*/
public function map(Router $router)
{
$router->group(['namespace' => __NAMESPACE__ . '\Controllers', 'middleware' => 'web'], function () {
require __DIR__ . '/routes.php';
$router->group(['namespace' => __NAMESPACE__ . '\Controllers', 'middleware' => 'web'], function () use ($router) {
$router->get('ajax/jetpages/timestamp', 'PageController@getContentTimestamp');

$router->group(['middleware' => ['static-cache']], function () use ($router) {
$router->get('robots.txt', 'RobotsTxtController@robots');
$router->get('sitemap.xml', 'SiteMapController@sitemap');
});
});

// Add these routes after bootstrap is done in order to make them last in
// the route list. Otherwise, catch-all route will break some other
// routes registered after it.
$this->app->booted(function () use ($router) {
$router->group(['namespace' => __NAMESPACE__ . '\Controllers', 'middleware' => ['web', 'static-cache']], function () use ($router) {
// Specific override for a front page to overcome default laravel's route in app/Http/routes.php
$router->get('/', 'PageController@show');
$router->get('{all}', 'PageController@show')->where(['all' => '.*']);
});
});
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/resources/config/jetpages.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
| this folder.
|
*/
'content_root' => resource_path('content'),
'content_root' => 'resources/content',

/*
|--------------------------------------------------------------------------
Expand Down
12 changes: 0 additions & 12 deletions src/routes.php

This file was deleted.

0 comments on commit ac0c96f

Please sign in to comment.