Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the ot-apollo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home3/achieve/public_html/knowledgebase/wp-includes/functions.php on line 6131

Warning: Cannot modify header information - headers already sent by (output started at /home3/achieve/public_html/knowledgebase/wp-includes/functions.php:6131) in /home3/achieve/public_html/knowledgebase/wp-includes/feed-rss2.php on line 8
Request – Knowledge https://knowledge.achieveee.com Wed, 03 Apr 2019 14:23:43 +0000 en-US hourly 1 https://wordpress.org/?v=6.9.4 https://knowledge.achieveee.com/wp-content/uploads/2016/05/cropped-favicon-32x32.png Request – Knowledge https://knowledge.achieveee.com 32 32 Clean and correct way to call a request internally in Laravel 5+ https://knowledge.achieveee.com/knowledge_base/clean-and-correct-way-to-call-a-request-internally-in-laravel-5/?utm_source=rss&utm_medium=rss&utm_campaign=clean-and-correct-way-to-call-a-request-internally-in-laravel-5 https://knowledge.achieveee.com/knowledge_base/clean-and-correct-way-to-call-a-request-internally-in-laravel-5/#respond Fri, 06 May 2016 15:01:11 +0000 http://achieveee.com/knowledgebase/?post_type=knowledge_base&p=2456 To call a Laravel 5.* Request internally and complete the request life cycle, below are the steps to follow for various methods:

  1. GET

    $request = Request::create(url, 'GET');
    $response = Route::dispatch($request);
    return $response;
  2. POST (with parameters)

    $params = array(
        'product_code' => 'GYU16R',
        'qty' => '1',
        'price' => 660,
    );
    
    $request = Request::create(url, 'POST', $params);
    $response = app()->handle($request);
    return $response;

Note:
Always use full absolute path as url while creating request.
Eg: Use http://localhost/edit-user instead of /edit-user

]]>
https://knowledge.achieveee.com/knowledge_base/clean-and-correct-way-to-call-a-request-internally-in-laravel-5/feed/ 0