0

I have an laravel application and also included an php file for a Payment Package,im Passing two url parameters from my laravel route to this Php File .How can i access the passed url parameters in this Php file.

Route::get('payumoneypayment/{courseid}/{userid}', function() {
    include_once(app_path() . '/payu/index.php');  
  });

The route passed from laravel is like this eg http://127.0.0.1:8000/payumoneypayment/1152/44 In my index.php file ,i tried using $userid = $_REQUEST['userid']; but im not getting the request value in php file

2
  • I'de suggest reading the documentation since you do not seem to understand some of the basic workings of Laravel. Route Parameters, and take a look at Views as well. Commented Jan 1, 2021 at 11:16
  • ok isure thanks for the info@Remy Commented Jan 2, 2021 at 4:56

1 Answer 1

1

you should do something like this:

Route::get('payumoneypayment/{courseid}/{userid}', function($courseid, $userid) {
    return view('payumoneypayment', [
        'courseid' => $courseid,
        'userid' => $userid,
    ]);  
});

After that, in your payumoneypayment view (file payumoneypayment.blade.php):

<?php
include_once(app_path() . '/payu/index.php');

And you will have the variables $courseid and $userid usable in your index.php file.

P.S. its not a good practice use include_once in a blade template file, just use its syntax (@include directive).

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.