A
A
Alexander Shapoval2016-09-21 22:36:45
Laravel
Alexander Shapoval, 2016-09-21 22:36:45

How to make a request to a method with a parameter (Request $request) in Laravel?

There is a javascript code that does this:

$.get( "calendar", requests, function( data ) {
        $( "#result" ).html( data );
});

From there the data is returned. How can I make the same request, only from a neighboring method in the same php class, only using the built-in methods of Laravel itself and php?
Thank you for your help!
UPD: Yes, I forgot to mention that the method from which the call will be made must form a new request from the incoming get() parameters and pass it. That is, initially I do not have $request, it needs to be created

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Pochepko, 2016-09-21
@AlexanderShapoval

Most likely you need to make a normal call to the neighboring method

function foo(Request $request) {
    return $this->bar($request);
}

function bar(Request $request) {

// Your code
    return ...;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question