Support the ongoing development of Laravel.io →
Database Eloquent Forms
Last updated 2 years ago.
0

Use something like this; This will get a list of all the subjects within the Topics Model.

Topics::select(\DB::raw('DISTINCT `subject`'))->get() 
Last updated 2 years ago.
0

It works, thank you very much. But it creates a very odd mess in my form. I pick up the data the way you suggested and put into form like this:

{{ Form::select('domain', $domains) }}

It does print only single domain from the list but in the following format:

{"domain":"google.com"}

instead of just listing domain name.

I must be missing something in the way I'm creating my form.

Last updated 2 years ago.
0

Try this within your form;

$domains->lists('domain')

To get both the value of the drop list to be the domain and the visual drop box selection to be the same do this;

$domains->lists('domain','domain')
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.