where('user_id', $user_id)->value('user_name'); $contract = DB::table('regular_contract') ->join('park', 'regular_contract.park_id', '=', 'park.park_id') ->where('contract_id', $contract_id) ->select('regular_contract.contract_id', 'park.park_name') ->first(); \Log::info('シール再発行確認画面にアクセス', [ 'user_id' => $user_id, ]); return view('regular_contract.seal_reissue', [ 'contract' => $contract, 'active_menu' => 'SWC-3-1', // マイページメニューの選択状態用 'user_name' => $user_name ? $user_name : '', // ユーザー名(ヘッダー用) ]); } public function reason($contract_id) { $user_id = session('user_id'); if (!$user_id) { return redirect('/login'); } $user_name = DB::table('user')->where('user_id', $user_id)->value('user_name'); \Log::info('シール再発行理由入力画面にアクセス', [ 'user_id' => $user_id, ]); return view('regular_contract.seal_reissue_reason', [ 'contract_id' => $contract_id, 'active_menu' => 'SWC-3-1', // マイページメニューの選択状態用 'user_name' => $user_name ? $user_name : '', // ユーザー名(ヘッダー用) ]); } public function complete(Request $request, $contract_id) { $user_id = session('user_id'); if (!$user_id) { return redirect('/login'); } $user_name = DB::table('user')->where('user_id', $user_id)->value('user_name'); $validated = $request->validate([ 'reason' => ['required'], 'other_reason' => [ 'nullable', 'string', 'max:255', 'regex:/^[\x20-\x7Eぁ-んァ-ヶ一-龠々ーa-zA-Z0-90-9a-zA-Z、。・「」『』()【】[]{}〈〉《》!?:;…ー~\s\r\n]+$/u', 'required_if:reason,その他' ], ], [ 'reason.required' => '理由を選択してください。', 'other_reason.max' => 'その他の理由は255文字以内で入力してください。', 'other_reason.regex' => 'その他の理由に使用できない文字が含まれています。', 'other_reason.required_if' => 'その他を選択した場合は理由を入力してください。' ]); $contract = DB::table('regular_contract') ->join('park', 'regular_contract.park_id', '=', 'park.park_id') ->where('contract_id', $contract_id) ->select('regular_contract.contract_id', 'park.park_name') ->first(); $reason = $request->input('reason'); $other_reason = $request->input('other_reason'); \Log::info('シール再発行申請完了画面にアクセス', [ 'user_id' => $user_id, ]); return view('regular_contract.seal_reissue_complete', [ 'active_menu' => 'SWC-3-1', // マイページメニューの選択状態用 'user_name' => $user_name ? $user_name : '', // ユーザー名(ヘッダー用) 'contract' => $contract ]); } }