Skip to content

Commit d14da4b

Browse files
committed
Don’t autoload middleware (session issues)
1 parent 6402188 commit d14da4b

File tree

3 files changed

+16
-22
lines changed

3 files changed

+16
-22
lines changed

CHANGELOG.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,16 @@
22

33
All Notable changes to `StageFront` will be documented in this file.
44

5-
## 1.0.0 (2017-10-10)
5+
## 1.1.1 (2017-10-10)
66

7-
- Version 1.0.0 of `StageFront`
7+
- Don't autoload middleware due to session issues
88

99
## 1.1.0 (2017-10-10)
1010

1111
- Add login throttling
1212
- Autoload middleware
1313
- Disable Laravel Debugbar on all StageFront routes
14+
15+
## 1.0.0 (2017-10-10)
16+
17+
- Version 1.0.0 of `StageFront`

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Shielding a staging or demo website from the public usually involves setting op
1313

1414
It doesn't have to be!
1515

16-
By installing StageFront with composer and setting 3 variables in your `.env` you are ready to go. As you will discover below, you also have a bunch more options available.
16+
By installing StageFront with composer, adding the middleware and setting 3 variables in your `.env` you are ready to go. As you will discover below, you also have a bunch more options available.
1717

1818
## Requirements
1919

@@ -27,10 +27,17 @@ Require the package via Composer:
2727
```
2828
composer require codezero/laravel-stagefront
2929
```
30+
Add the middleware to the web middleware group, **right after the `SartSession` middleware** in `app/Http/Kernel.php`:
3031

31-
Laravel will automatically register the [`ServiceProvider`](https://github.com/codezero-be/laravel-stagefront/blob/master/src/StageFrontServiceProvider.php) and the [`RedirectIfStageFrontIsEnabled`](https://github.com/codezero-be/laravel-stagefront/blob/master/src/Middleware/RedirectIfStageFrontIsEnabled.php) middleware. You just need to set some `.env` variables and your up and running!
32+
```php
33+
\CodeZero\StageFront\Middleware\RedirectIfStageFrontIsEnabled::class,
34+
```
35+
36+
Laravel will automatically register the [ServiceProvider](https://github.com/codezero-be/laravel-stagefront/blob/master/src/StageFrontServiceProvider.php) and routes.
37+
38+
When StageFront is disabled, its routes will not be registered.
3239

33-
When StageFront is disabled, its routes and middleware will not be registered.
40+
Now you just need to set some `.env` variables and you are up and running!
3441

3542
## Quick Setup
3643

src/StageFrontServiceProvider.php

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
namespace CodeZero\StageFront;
44

55
use CodeZero\StageFront\Composers\ThrottleTimeRemaining;
6-
use CodeZero\StageFront\Middleware\RedirectIfStageFrontIsEnabled;
7-
use Illuminate\Contracts\Http\Kernel;
86
use Illuminate\Support\ServiceProvider;
97

108
class StageFrontServiceProvider extends ServiceProvider
@@ -27,7 +25,6 @@ public function boot()
2725
$this->loadViews();
2826
$this->loadViewComposers();
2927
$this->loadTranslations();
30-
$this->loadMiddleware();
3128
$this->registerPublishableFiles();
3229
}
3330

@@ -81,20 +78,6 @@ protected function loadTranslations()
8178
$this->loadTranslationsFrom(__DIR__.'/../resources/lang', $this->name);
8279
}
8380

84-
/**
85-
* Load the package middleware.
86-
*
87-
* @return void
88-
*/
89-
protected function loadMiddleware()
90-
{
91-
if (config('stagefront.enabled') === true) {
92-
app(Kernel::class)->pushMiddleware(
93-
RedirectIfStageFrontIsEnabled::class
94-
);
95-
}
96-
}
97-
9881
/**
9982
* Register the publishable files.
10083
*

0 commit comments

Comments
 (0)