I am trying to check if POST data has been sent to a page. A quick Google search turned up nothing.
if(postdataisSent)
{
//do this
}
else
$items = Gamefarm::where('roost_hen', '=', 1)->paginate(6);
return View::make('gamefarms/index',compact('items'));
You can use if ( Input::has('parameter') )
to check for the existence of a certain parameter in the POST, or you can pass a default into the function, and then test if it's there.
$parameter = Input::get('parameter', false);
if ($parameter)
{
// do something with the data
}
else
{
// it's not present in the POST
}
To check for the presence of any data at all:
$data = Input::all();
if (count($data) > 0)
{
// there is data in the POST
}
else
{
// there is no data in the POST
}
Note - You can access the data from any HTTP verb (GET, POST etc) using the same Input::get('data')