Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

ahoi's avatar
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:

  1. Go to your team at /teams/{id}
  2. Choose "Manage subscription"
  3. Get redirected to /billing/team/{id}
  4. Perform payment
  5. 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?

0 likes
0 replies

Please or to participate in this conversation.