Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[10.0] Add ability to ignore cashier routes #763

Merged
merged 2 commits into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions src/Cashier.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ class Cashier
*/
public static $runsMigrations = true;

/**
* Indicates if Cashier routes will be registered.
*
* @var bool
*/
public static $registersRoutes = true;

/**
* Get the default Stripe API options.
*
Expand Down Expand Up @@ -95,4 +102,16 @@ public static function ignoreMigrations()

return new static;
}

/**
* Configure Cashier to not register its routes.
*
* @return static
*/
public static function ignoreRoutes()
{
static::$registersRoutes = false;

return new static;
}
}
16 changes: 9 additions & 7 deletions src/CashierServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,13 +56,15 @@ protected function configure()
*/
protected function registerRoutes()
{
Route::group([
'prefix' => config('cashier.path'),
'namespace' => 'Laravel\Cashier\Http\Controllers',
'as' => 'cashier.',
], function () {
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
});
if (Cashier::$registersRoutes) {
Route::group([
'prefix' => config('cashier.path'),
'namespace' => 'Laravel\Cashier\Http\Controllers',
'as' => 'cashier.',
], function () {
$this->loadRoutesFrom(__DIR__.'/../routes/web.php');
});
}
}

/**
Expand Down