micheal
7 months ago

bus transport system

Posted 7 months ago by micheal

I am making a simple bus transport system. there are a route and city table in the database. i have defined many cities. there are "from" and "to" column in the route table and it sould display form city table. i works correctly untill here, but when admin choose city "number 1" in " from" input , therefor "city number 1" should not be displayed or it become disabled in the "to" input in the form. any assist would be realy appreciated.

--------this is route form-------


   <div class="form-group">
                    <label>From:</label>
                    <select name="from" id="" class="js-example-placeholder-singlefrom js-states form-control" style="width: 100%; height:40px;">
                        <option></option>
                            @foreach($cities as $city)
                                <option value="{{ $city->id}}" {{(old('from')==$city->id)? 'selected':''}}> {{ $province->name}}</option>
                            @endforeach
                    </select>
                </div>

                <div class="form-group">
                    <label>From:</label>
                    <select name="to" id="" class="js-example-placeholder-singleto js-states form-control" style="width: 100%; height:40px;">
                        <option></option>
                            @foreach($cities as $city)
                                <option value="{{ $city->id}}" {{(old('to')==$city->id)? 'selected':''}}> {{ $province->name}}</option>
                            @endforeach
                    </select>
                </div>

-----this is route controller--------

 public function create(City $city)
    {
        $cities = City::all();
        return view('route.create',compact('cities'));
    }








Please sign in or create an account to participate in this conversation.