1 year ago

Select box with first option empty

Posted 1 year ago by pordonez

Hi, I'm using Laravel 5.5 and I don't know how to add empty option from the select. All the values are fetched from database.

here is my controller: public function addlead() { $campaignLists = ['' => 'Select Campaign'] + Campaigns::where('c_status', '1')->pluck('c_campaign_name', 'c_id'); return view('addlead', ['campaignLists' => $campaignLists]);


and here is my blade: {{ Form::select('c_id', $campaignLists, null, ['class' => 'form-control', 'id' => 'campaignDropDown']) }}

and the error im getting is: Object of class Illuminate\Support\Collection could not be converted to int

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