@php $name = $id = 'fillEmployeeTeacherId'; $label = isset($element['label']) ? $element['label'] . '*' : 'Employee/Teacher:'; $allOption = isset($element['alloption']) ? $element['alloption'] : 'yes'; $class = 'form-control custom-select2'; if (isset($element['attributes']['class'])) { $class .= ' ' . $element['attributes']['class']; } $attributes = ['id' => $id, 'class' => $class]; if (isset($element['attributes'])) { $attributes = array_merge($attributes, $element['attributes']); } if ($allOption == 'no') { $alloptions = ''; $employees = DB::table('hr_emp_general_info') ->select(DB::raw("CONCAT('emp_id', ' - ', 'emp_name_english') AS name,id")) ->pluck('name', 'id') ->toArray(); if (isset($element['options'])) { $options = $element['options']; } else { $options = DB::table('hr_emp_general_info') ->select(DB::raw("CONCAT(LPAD(emp_id, 5, 0), ' - ', emp_name_english) AS nameWithCode"), 'id') ->pluck('nameWithCode', 'id') ->all(); } } else { $alloptions = ['' => 'All']; $employees = $alloptions + DB::table('hr_emp_general_info') ->select(DB::raw("CONCAT('emp_id', ' - ', 'emp_name_english') AS name,id")) ->pluck('name', 'id') ->toArray(); if (isset($element['options'])) { $options = $element['options']; } else { $options = $alloptions + DB::table('hr_emp_general_info') ->select(DB::raw("CONCAT(LPAD(emp_id, 5, 0), ' - ', emp_name_english) AS nameWithCode"), 'id') ->pluck('nameWithCode', 'id') ->all(); } } $defaultValue = isset($element['defaultValue']) ? $element['defaultValue'] : ''; @endphp
{!! Form::label($name, $label, ['class' => 'control-label'], false) !!}
{!! Form::select($name, $options, $defaultValue, $attributes) !!}