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

JoaquinVilchez's avatar

Redirect to two different routes in the controller at the same time (new tab).

Hello how are you.

I wanted to know if there is any possibility of redirecting to two different routes at the same time.

I have an order system.

What I want to do is that when an order is confirmed, automatically, the order goes to an "Accepted" state and that it opens a URL to be able to contact the customer through WhatsApp (New tab that opens WhatsApp web with the WP API ) and at the same time return to the order page with back ()

I show you the controller I have so you can see how it would be.

public function accept(Request $request)
    {
        // dd($request->all());
        $order = Order::find($request->acceptorderid);
        $order->update([
            'state' => 'accepted'
        ]);
        
        // Searching the internet I thought I could do it this way, but I found no result.
        $newUrl='https://wa.me/'.str_replace('-', '', whatsappNumberCustomer($order)).'?text='.urlencode(whatsappMessageCustomer($order));
        session()->flash('newurl', $newUrl);
        // =============================================

        return back()->with('success_message', 'Pedido aceptado.');
    }

Thank you.

0 likes
3 replies
JoaquinVilchez's avatar

Thanks, I was able to solve it in a simple way. Use an onload = "window.open" if there is a session which you previously created in the controller as the article you passed me siangboon.

When I work with Vue I will improve it.

Thank you.

Please or to participate in this conversation.