@php $isModification = request()->has('id_order_fabrication'); $isPlanningPrev = request()->has('planning_prev'); $commande=\App\Models\commande::find($commande_id); $planningClass = $commande->commande_of == 1 ? \App\Models\planning::class : \App\Models\planning_prev::class; $planning = $isModification ? $planningClass::find(request()->input('id_order_fabrication')) : null; $vehicule_selectionne = $isModification ? $planning?->lier_vehicule : $commande->lier_vehicule; $chauffeurs=\App\Models\chauffeur::get(); $centrales=\App\Models\centrale::get(); function heurePlanning($planning, $champ) { return !empty($planning?->$champ) ? date('H:i', strtotime($planning->$champ)) : '00:00'; } @endphp