9 months ago

Using Select Blade

Posted 9 months ago by kshitizmittal

I am trying to implement dropdown in blade like this,

{!! Form::select('holiday_calender', [null=>'Please Select Calendar'] + $holidayCalenders ,$assignedtanda->holiday_calendar, array('class' => 'form-control')) !!}


$holidayCalenders = Holidaycalander::where(['status'=>'on'])->pluck('name','id');

Dump of Holiday Calendar :-

Collection {#2727 ▼
  #items: array:1 [▼
    1 => "India"

In DB $assignedtanda->holiday_calendar this returns 1

Desired result :-

<select class="form-control" name="holiday_calender" id="holidaycalender">
    <option value="">Select Holiday Calender </option>
    <option selected="true" value="1">India</option>

Error Message :-

"Object of class Illuminate\Support\Collection could not be converted to int (View: C:\inetpub\wwwroot\jconnectp4\resources\views\eno\edituser\timeandattendance.blade.php) (View: C:\inetpub\wwwroot\jconnectp4\resources\views\eno\edituser\timeandattendance.blade.php) ◀"

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