return variable in post larvel code example Example: check method in laravel if ($request->isMethod('post')) { return ['user' => $user]; }