We often write if statements to check if a value is present on a request or not.
You can simplify it with the whenFilled()
helper.
1public function store(Request $request)2{3 $request->whenFilled('status', function (string $status)) {4 // Do something amazing with the status here!5 }, function () {6 // This it called when status is not filled7 });8}
Tip given by @mmartin_joo