Use theme check in all frontend routes #638 (#645)

This commit is contained in:
Nabeel S 2020-03-28 14:45:25 -04:00 committed by GitHub
parent ba0ae05c2a
commit 3e7d5f6195
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 8 deletions

View File

@ -15,6 +15,5 @@ class PageIconNullable extends Migration
public function down()
{
}
}

View File

@ -7,6 +7,7 @@ use App\Http\Middleware\EncryptCookies;
use App\Http\Middleware\InstalledCheck;
use App\Http\Middleware\JsonResponse;
use App\Http\Middleware\RedirectIfAuthenticated;
use App\Http\Middleware\SetActiveTheme;
use App\Http\Middleware\TrustProxies;
use App\Http\Middleware\UpdatePending;
use Illuminate\Auth\Middleware\Authenticate;
@ -54,6 +55,7 @@ class Kernel extends HttpKernel
'can' => Authorize::class,
'guest' => RedirectIfAuthenticated::class,
'json' => JsonResponse::class,
'theme' => SetActiveTheme::class,
'throttle' => ThrottleRequests::class,
'update_pending' => UpdatePending::class,
];

View File

@ -2,7 +2,6 @@
namespace App\Providers;
use App\Http\Middleware\SetActiveTheme;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Route;
@ -40,14 +39,14 @@ class RouteServiceProvider extends ServiceProvider
private function mapWebRoutes()
{
Route::group([
'middleware' => 'web',
'middleware' => ['web', 'theme'],
'namespace' => $this->namespace,
], function ($router) {
Route::group([
'namespace' => 'Frontend',
'prefix' => '',
'as' => 'frontend.',
'middleware' => ['auth', SetActiveTheme::class],
'middleware' => ['auth'],
], function () {
Route::resource('dashboard', 'DashboardController');
@ -85,10 +84,9 @@ class RouteServiceProvider extends ServiceProvider
});
Route::group([
'namespace' => 'Frontend',
'prefix' => '',
'as' => 'frontend.',
'middleware' => [SetActiveTheme::class],
'namespace' => 'Frontend',
'prefix' => '',
'as' => 'frontend.',
], function () {
Route::get('/', 'HomeController@index')->name('home');
Route::get('r/{id}', 'PirepController@show')->name('pirep.show.public');