Sometimes we need to grab only the request data which was sent through a form. Laravel’s
$request->all() class returns all data – including that from the query string. This issue comes up often when using complex resource controllers over 2 models. Take the following example for updating pivot data on a Many-to-Many relationship via complex resource controller:
We start by extending
Now we inject it into our controller and can access the method.