Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to retrieve GET parameters using laravel

Tags:

php

laravel

I am working on a Laravel project and am trying to get GET parameters from a controller. Requesting a page with ?date={value} should return value as follows:

public function getIndex(Request $request) {
    return $request->input("date");
}

This does not work though. POST requests work as they should. I am using nginx through cloudflare. I tried making a plain PHP file with

echo $_GET["date"];

which works fine.

like image 203
Streetlamp Avatar asked Aug 10 '15 17:08

Streetlamp


1 Answers

I found my problem. In the nginx configuration for the site (/etc/nginx/sites-available/default), I had

location / {
    try_files $uri $uri/ /index.php?;
}

which should be

location / {
    try_files $uri $uri/ /index.php?$query_string;
}

Fixed, restarted, now it works.

like image 125
Streetlamp Avatar answered Oct 27 '22 14:10

Streetlamp