🎎
Custom Billables
By default, the billing is made directly on the currently authenticated model. In some cases like using the billable trait on the Team model, you may change the model that will be retrieved from the current request.
You may define it in the boot() method of BillingPortalServiceProvider:
1
use Illuminate\Http\Request;
2
use RenokiCo\BillingPortal\BillingPortal;
3
​
4
class BillingPortalServiceProvider extends BaseServiceProvider
5
{
6
/**
7
* Boot the service provider.
8
*
9
* @return void
10
*/
11
public function boot()
12
{
13
parent::boot();
14
​
15
BillingPortal::resolveBillable(function (Request $request) {
16
return $request->user()->currentTeam;
17
});
18
}
19
}
Copied!
Copy link
Edit on GitHub