Skip to content

Commit 2ce23af

Browse files
correcoes e implementacoes assinatura
1 parent 3ebc9da commit 2ce23af

11 files changed

+676
-29
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace App\Http\Controllers\Onboarding;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Http\Request;
7+
8+
class SubscribeController extends Controller
9+
{
10+
public function __invoke()
11+
{
12+
$user = auth()->user();
13+
14+
$user->createOrGetStripeCustomer();
15+
16+
return $user->newSubscription('default', 'price_1SLA6rB7lWEhawxjvICNpu4c')
17+
->checkout()
18+
->redirect();
19+
}
20+
}

app/Models/User.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
use Illuminate\Database\Eloquent\Factories\HasFactory;
99
use Illuminate\Foundation\Auth\User as Authenticatable;
1010
use Illuminate\Notifications\Notifiable;
11+
use Laravel\Cashier\Billable;
1112
use OwenIt\Auditing\Contracts\Auditable;
1213

1314
class User extends Authenticatable implements Auditable
@@ -16,6 +17,7 @@ class User extends Authenticatable implements Auditable
1617
use \OwenIt\Auditing\Auditable;
1718
use HasFactory;
1819
use Notifiable;
20+
use Billable;
1921

2022
/**
2123
* The attributes that are mass assignable.

composer.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
"require": {
1212
"php": "^8.4",
1313
"inertiajs/inertia-laravel": "^2.0",
14+
"laravel/cashier": "^16.0",
1415
"laravel/framework": "^12.0",
1516
"laravel/tinker": "^2.10.1",
1617
"opcodesio/log-viewer": "^3.21",

0 commit comments

Comments
 (0)