mardi 17 avril 2018

Laravel 5: Check if post input query exists

In Laravel you can get all the post data like so:

$request->post();

You can also check if a form has the GET or POST query like so:

$request->has('foo');

However, how do I check if a form has a POST query. Note that I'm aware you can do the following:

$request->post('foo') !== null;

but foo can sometimes be null if the data being posted is JSON. e.g.

{
    "foo": null
}



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire