ArcticMediaRyan
ArcticMediaRyan

Reputation: 885

Redirect using get and then redirect to the response

Lets start off with the code

if($request->berbix == true || $request->berbix == 'true'){
          THIS IS WHERE I NEED THE LOGIC TO GO  
        }
        else {
        session()->flash('flash.banner', 'Profile updated!');
        session()->flash('flash.bannerStyle', 'success');
        return Redirect::route('dashboard');
        }

In the if statement this is what needs to happen.

I know this should be simple but I am having a HECK of a time wrapping my head around the simple logic. The main thing I am struggling with (and I know why, but don't know how to solve it), is when I do for example Http::get() it isnt sending it as the user so the request doesn't know the user info

Any help either a solution or a nudge on what I need to do would be very nice right now!

Upvotes: 0

Views: 40

Answers (1)

matticustard
matticustard

Reputation: 5149

While I would still consider redirecting to a different route/controller to handle this, since you said you want it all in one place, it is possible to call controller methods directly and retrieve a response without leaving the current method or creating another HTTP request.

You could do something like this.

$url = app()->call('App\Http\Controllers\VerificationController@create', [
    'user' => auth()->user()
]);

if ($url) {
    return redirect($url);
}

Upvotes: 1

Related Questions