@@ -2,11 +2,15 @@
|
||||
|
||||
namespace App\Providers;
|
||||
|
||||
use App\Http\Responses\RegisterResponse;
|
||||
use App\Models\Organization;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Support\Facades\Date;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Validation\Rules\Password;
|
||||
use Laravel\Cashier\Cashier;
|
||||
use Laravel\Fortify\Contracts\RegisterResponse as RegisterResponseContract;
|
||||
|
||||
class AppServiceProvider extends ServiceProvider
|
||||
{
|
||||
@@ -15,7 +19,19 @@ class AppServiceProvider extends ServiceProvider
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
//
|
||||
$this->registerFortifyResponses();
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap Fortify's registration response for one that starts checkout for the
|
||||
* plan the account signed up with.
|
||||
*/
|
||||
protected function registerFortifyResponses(): void
|
||||
{
|
||||
$this->app->singleton(
|
||||
RegisterResponseContract::class,
|
||||
RegisterResponse::class,
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -24,6 +40,16 @@ class AppServiceProvider extends ServiceProvider
|
||||
public function boot(): void
|
||||
{
|
||||
$this->configureDefaults();
|
||||
$this->configureCashier();
|
||||
}
|
||||
|
||||
/**
|
||||
* Make organizations, rather than users, the Stripe customer. This also
|
||||
* determines the foreign key Cashier uses on the subscriptions table.
|
||||
*/
|
||||
protected function configureCashier(): void
|
||||
{
|
||||
Cashier::useCustomerModel(Organization::class);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user