@php $routeParam = str_replace("-","_", $route); $routeParams = [$routeParam => $item->id]; if(isset($item->rental_type_id)) { $routeParams['rental_type_id'] = $item->rental_type_id; } @endphp