parent
3242ae9cbe
commit
a9ffd378a0
@ -0,0 +1,14 @@ |
||||
<?php |
||||
|
||||
|
||||
namespace App\View; |
||||
|
||||
|
||||
class CheckboxWidget extends Widget |
||||
{ |
||||
public function checked($condition=true) |
||||
{ |
||||
$this->value = (bool)$condition; |
||||
return $this; |
||||
} |
||||
} |
@ -0,0 +1,22 @@ |
||||
@php |
||||
/** @var \App\View\Widget $w */ |
||||
@endphp |
||||
|
||||
<div class="row form-group"> |
||||
<div class="col-md-{{$w->fieldCols}} offset-md-{{$w->labelCols}}"> |
||||
<div class="custom-control custom-checkbox{{ $errors->has($w->name) ? ' is-invalid' : '' }}"> |
||||
<input type="checkbox" class="custom-control-input" |
||||
id="field-{{ $w->name }}" |
||||
{{+$w->value?'checked':''}} |
||||
name="{{ $w->name }}"> |
||||
<label class="custom-control-label" for="field-{{ $w->name }}">{{ $w->label }}</label> |
||||
</div> |
||||
|
||||
@if ($errors->has($w->name)) |
||||
<span class="invalid-feedback" role="alert"> |
||||
<strong>{{ $errors->first($w->name) }}</strong> |
||||
</span> |
||||
@endif |
||||
</div> |
||||
@include('form._help') |
||||
</div> |
Loading…
Reference in new issue