Skip to content

Commit

Permalink
Merge pull request #755 from crynobone/avoid-exception
Browse files Browse the repository at this point in the history
[5.x] Avoid throwing exception on production.
  • Loading branch information
taylorotwell authored Mar 23, 2020
2 parents da28590 + 50764f9 commit 5b0411a
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions src/DuskServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Laravel\Dusk;

use Exception;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\ServiceProvider;

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

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

Route::get('/_dusk/user/{guard?}', [
'middleware' => 'web',
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@user',
]);
Route::get('/_dusk/user/{guard?}', [
'middleware' => 'web',
'uses' => 'Laravel\Dusk\Http\Controllers\UserController@user',
]);
}
}

/**
Expand All @@ -40,10 +41,6 @@ public function boot()
*/
public function register()
{
if ($this->app->environment('production')) {
throw new Exception('It is unsafe to run Dusk in production.');
}

if ($this->app->runningInConsole()) {
$this->commands([
Console\InstallCommand::class,
Expand Down

0 comments on commit 5b0411a

Please sign in to comment.