Skip to content

Commit

Permalink
fix: test
Browse files Browse the repository at this point in the history
  • Loading branch information
pushpak1300 committed Dec 21, 2024
1 parent e4697fa commit ab6fd2c
Show file tree
Hide file tree
Showing 5 changed files with 147 additions and 7 deletions.
13 changes: 8 additions & 5 deletions app/Actions/Fortify/CreateNewUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Models\User;
use Stripe\Customer;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Str;
use Laravel\Jetstream\Jetstream;
use Illuminate\Support\Facades\DB;
Expand Down Expand Up @@ -60,11 +61,13 @@ private function createTeam(User $user): void
*/
private function createCustomer(User $user): void
{
/** @var Customer $stripeCustomer */
$stripeCustomer = $user->createOrGetStripeCustomer();
if (Config::get('cashier.billing_enabled')) {
/** @var Customer $stripeCustomer */
$stripeCustomer = $user->createOrGetStripeCustomer();

$user->update([
'stripe_id' => $stripeCustomer->id,
]);
$user->update([
'stripe_id' => $stripeCustomer?->id,
]);
}
}
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
"nunomaduro/collision": "^8.1",
"pestphp/pest": "^3.5",
"pestphp/pest-plugin-laravel": "^3.0",
"pestphp/pest-plugin-type-coverage": "^3.2",
"rector/rector": "^2.0"
},
"autoload": {
Expand Down
131 changes: 130 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions config/cashier.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,4 +124,6 @@

'logger' => env('CASHIER_LOGGER'),

'billing_enabled' => (bool) (env('STRIPE_KEY', false) && env('STRIPE_SECRET', false)),

];
7 changes: 6 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use App\Http\Controllers\DashboardController;
use App\Http\Controllers\User\OauthController;
use App\Http\Controllers\SubscriptionController;
use Illuminate\Support\Facades\Config;

Route::get('/', [WelcomeController::class, 'home'])->name('home');

Expand All @@ -22,5 +23,9 @@

Route::get('/chat', [ChatController::class, 'index'])->name('chat.index');

Route::resource('/subscriptions', SubscriptionController::class)->names('subscriptions')->only(['index', 'create', 'store', 'show']);
if (Config::get('cashier.billing_enabled')) {
Route::resource('/subscriptions', SubscriptionController::class)
->names('subscriptions')
->only(['index', 'create', 'store', 'show']);
}
});

0 comments on commit ab6fd2c

Please sign in to comment.