Latest

Thursday, July 6, 2017

Laravel collective form and foreach loop

Asked by: Bartosz Rowiński


I want to connect my dropdown select form with database, currentli I have sth like this:

                 @foreach( $clients as $client)
                    {!! Form::select('connected_with',
                     ['name' => $client->name . $client->surname
                      ]) !!}
                    @endforeach

And this is my controller:

        $clients = Client::all();

        return view('report_create')->with('clients', $clients);

and i get much fields. I want only one with items from db. How to do it?



Source

No comments:

Post a Comment

Adbox