ALINAWAZ
3 months ago
312
5
Laravel

Redirect to Specify Blade in Laravel Issue

Posted 3 months ago by ALINAWAZ

Step - 1 I am using one axios call in Vue Template in larvel

 payPal(){
     
                    let formData = new FormData();
                    formData.append('packageId',this.PackageId);
                    axios.post('/untyme/public/payPalPayment',formData).then(function (resp) {


                    }).catch(function (resp) {

                    });
                },

Step - 2 and defined the Route in in Route File

Route::post('/payPalPayment', '[email protected]')->name('payPalPayment');

Step - 3

Now I am going to the MessageCredit controller in defind our function according to our requirement

public function payPalPayment(Request $request) {

    $email = DB::table('settings')->select('data')->where('name','paypal_fields')->get();
    $site_url = "https://untyme.com/untyme/public/";
    $business_email = $email;
    $user_id = Auth::id();
    $package_id = "";
    $package_title = "";
    $custom = "";
    $price = 0;

    if (!empty($request['packageId'])) {
        $package_id = $request['packageId'];
    }

    if (!empty($package_id) && !empty($user_id)) {
        $package_row = paidpackagemange::where('id', $package_id)->first();

        $package_title = $package_row->title;
        $price = $package_row->price;
        $credits = $package_row->credits;

        $custom = $user_id . "##" . $package_id . "##" . $price . "##" . $credits;
    }
    return view('MessageCredit.PaymentShow')->with('site_url', $site_url)->with('business_email', $business_email)->with('package_title', $package_title)->with('price', $price)->with('credits', $credits)->with('custom', $custom);
}

Step - 4 My issues is at the end of payPalPayment Method I am goind the to specify page with data at the specify blade (PaymentShow). But we cannot go to this page and get the response in browser console preview

Please sign in or create an account to participate in this conversation.