Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Nov 5, 2017
1 parent bb57ed2 commit dd481ec
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion src/helpers/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -421,8 +421,9 @@ function makeValidationForHTML($rules)
* @param $value
* @return string
*/
function findSelected($rawvalue, $form, $option_value, $value)
function findSelected($rawvalue, $form, $option_value)
{
$value = $rawvalue;
if (! $rawvalue) {
return '';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@
@endif

@foreach (DB::select(DB::raw($query)) as $row)
<option {{findSelected($value, $form, $row->$select_value, $value)}} value='{!! $row->$select_value !!}'>{!! $row->$select_label !!}</option>
<option {{findSelected($value, $form, $row->$select_value)}} value='{!! $row->$select_value !!}'>{!! $row->$select_label !!}</option>
@endforeach

<!--end-datatable-ajax-->
@else
@if($value)
@foreach(DB::select(DB::raw($query)) as $row)
<option value="{{$row->$select_value}}" {!! findSelected($value, $form, $row->$select_value, $value) !!} > {{ $row->$select_label }} </option>
<option value="{{$row->$select_value}}" {!! findSelected($value, $form, $row->$select_value) !!} > {{ $row->$select_label }} </option>
@endforeach
@endif
@endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
$option_label = str_replace("[".$k."]", $v, $option_label);
}
}
echo "<option ".findSelected($value, $form, $option_value, $value)." value='$option_value'>$option_label</option>";
echo "<option ".findSelected($value, $form, $option_value)." value='$option_value'>$option_label</option>";
}
?>
<!--end-datatable-ajax-->
Expand All @@ -112,7 +112,7 @@
$option_label = $r->$select_label;
}
@endphp
<option value="{{$option_value}}" {{findSelected($value, $form, $option_value, $value)}} >{{$option_label}}</option>
<option value="{{$option_value}}" {{findSelected($value, $form, $option_value)}} >{{$option_label}}</option>
@endforeach
@endif
@endif
Expand Down

0 comments on commit dd481ec

Please sign in to comment.