@extends('layouts.master') @section('title') @isset($data) Edit Branch @else Add Branch @endisset @endsection @section('content') @php // Get old values for country, state, city $oldCountry = old('country', isset($data) ? $data->region : null); $oldState = old('state', isset($data) ? $data->state : null); $oldCity = old('city', isset($data) ? $data->city : null); // Get all countries for the dropdown $countries = \App\Models\Country::all(); // Get states and cities if editing $states = collect(); $cities = collect(); if ($oldCountry) { $states = \App\Models\State::where('country_id', $oldCountry)->get(); } if ($oldState) { $cities = \App\Models\City::where('state_id', $oldState)->get(); } $currentStep = old('current_step', isset($data) ? $data->temp_step : 1); @endphp