@php $toasts = []; // 컨트롤러에서 with('toast', [...])로 보낸 경우 if (session()->has('toast')) { $t = session('toast'); if (is_array($t)) $toasts[] = $t; } // 라라벨 기본 status/error도 같이 지원 if (session()->has('status')) { $toasts[] = ['type' => 'success', 'title' => '안내', 'message' => (string) session('status')]; } if (session()->has('error')) { $toasts[] = ['type' => 'danger', 'title' => '오류', 'message' => (string) session('error')]; } // validation 에러도 토스트로 합치기(여러 줄) if ($errors->any()) { $toasts[] = [ 'type' => 'danger', 'title' => '입력 오류', 'message' => implode("\n", $errors->all()), ]; } @endphp @if(!empty($toasts))