@php $name = isset($element['name']) ? $element['name'] : 'fillEmployeeId'; $id = 'allfillEmployeeId'; $label = isset($element['label']) ? $element['label'] : 'Employee:'; $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