laravel request ismethod code example
Example 1: check method in laravel
if ($request->isMethod('post')) {
return ['user' => $user];
}
Example 2: laravel add request
$request->all() + ['index' => 'value'];
if ($request->isMethod('post')) {
return ['user' => $user];
}
$request->all() + ['index' => 'value'];