Dependent dropdown menus
A while ago I asked a similar question and had a couple of responses one has got me a bit closer but I'm still struggling with an issue.
routes.php
Route::get('/getStreets', function($id) {
return Street::whereSuburb($id)->get();
});
Street.php (Model)
public static function whereSuburb($id){ return DB::table('streets') ->select('streetName', 'id') ->where('suburbsId', '=', $id) ->get(); }
view.blade.php
{{ Form::open(['route' => 'get_address_path']) }} {{ Form::label('suburb', 'Suburb:') }} {{ Form::select('suburb', $suburbs, ['class' => 'form-control']) }} {{ Form::label('street_names', 'Street:') }}
</div>
<div class="form-group">
{{ Form::submit('Get Addresses',['class' => 'btn btn-default btn-xs']) }}
</div>
{{ Form::close() }}
```
When I change suburbs I get nothing happening, I've tested the model and whereSuburb($id) and I get what I'm after although I don't know if it is best practice but it is working.
Any ideas would be appreciated as I have for my application a few uses for dependent dropdown menus so it is really holding me up trying to figure this out.
Please or to participate in this conversation.