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

hjortur17's avatar

Return back not working

Hello, I'm trying to return back(); but when it happens it only returns the data, not the view. Any ideas on​ how to fix it?

Here is my function:

public function store(Reply $reply)
    {
        return $reply->favorite();

        return redirect()->back();
    }
``

And here is the response:

{"user_id":476,"favorited_id":6,"favorited_type":"App\Reply","updated_at":"2019-03-28 07:49:50","created_at":"2019-03-28 07:49:50","id":2}

0 likes
2 replies

Please or to participate in this conversation.