skip to Main Content

I am sending a mail and after mail is send I want to redirect user to a specific url

$mail = Mail::send('test.mail', ['a' => 'a'], function (Message $message) {
            $message->to(['[email protected]', '[email protected]',]);

            $message->from('[email protected]');
            $message->subject('Test Mail');
        });

//        dd($mail);
        return response()->redirectToRoute('allocate_supervisor')
            ->with('message', 'Supervisor Assigned and sent to HoD for approval.');

I have tried to return redirect()->route(), url(), and redirect(‘allocate_supervisor’) but each time same issue.

dd($mail); works fine and shows output but on redirect it shows blank page.

Also request status code is 200.

Also tried

ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);

before return still no output

2

Answers


  1. Chosen as BEST ANSWER

    I was calling storePhase function from store function and returning response from storePhase function which was being overridden in store function and I was receiving blank page...

    I moved this response code to store function and it worked fine.


  2. There are several ways to generate a RedirectResponse instance. The simplest method is to use the global redirect helper:

    return redirect('/allocate_supervisor');
    

    make sure ‘allocate_supervisor’ route must be present in your web.php file.

    if you have named routes, you may use route() method.

    return redirect()->route('/allocate_supervisor');
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search