Oct 26, 2021
0
Level 5
dashboardUrl(): Return billable id
Hello everybody,
in spark you may define a url to tell Spark, which target to use for the "Return to app"-link.
This is fine, if you got a User model as billable, but in my case, every user can manage multiple billables (e.g. multiple Teams).
The workflow at the moment is:
- Go to your team at /teams/{id}
- Choose "Manage subscription"
- Get redirected to /billing/team/{id}
- Perform payment
- Get redirected to /dashboard
The best solution would be to get redirected to /teams/1 again.
Currently I am using the referrer from the header in a callback function like this:
Route::get('dashboard', function(Request $request){
$ref = $request->headers->get('referer');
// get id using regex, and return redirect response
})->name('dashboard');
which is certainly not nice.
Any thoughts on this?
Please or to participate in this conversation.