Skip to content

Commit 5b0411a

Browse files
authored
Merge pull request #755 from crynobone/avoid-exception
[5.x] Avoid throwing exception on production.
2 parents da28590 + 50764f9 commit 5b0411a

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

src/DuskServiceProvider.php

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace Laravel\Dusk;
44

5-
use Exception;
65
use Illuminate\Support\Facades\Route;
76
use Illuminate\Support\ServiceProvider;
87

@@ -15,20 +14,22 @@ class DuskServiceProvider extends ServiceProvider
1514
*/
1615
public function boot()
1716
{
18-
Route::get('/_dusk/login/{userId}/{guard?}', [
19-
'middleware' => 'web',
20-
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@login',
21-
]);
17+
if (! $this->app->environment('production')) {
18+
Route::get('/_dusk/login/{userId}/{guard?}', [
19+
'middleware' => 'web',
20+
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@login',
21+
]);
2222

23-
Route::get('/_dusk/logout/{guard?}', [
24-
'middleware' => 'web',
25-
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@logout',
26-
]);
23+
Route::get('/_dusk/logout/{guard?}', [
24+
'middleware' => 'web',
25+
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@logout',
26+
]);
2727

28-
Route::get('/_dusk/user/{guard?}', [
29-
'middleware' => 'web',
30-
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@user',
31-
]);
28+
Route::get('/_dusk/user/{guard?}', [
29+
'middleware' => 'web',
30+
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@user',
31+
]);
32+
}
3233
}
3334

3435
/**
@@ -40,10 +41,6 @@ public function boot()
4041
*/
4142
public function register()
4243
{
43-
if ($this->app->environment('production')) {
44-
throw new Exception('It is unsafe to run Dusk in production.');
45-
}
46-
4744
if ($this->app->runningInConsole()) {
4845
$this->commands([
4946
Console\InstallCommand::class,

0 commit comments

Comments
 (0)