Skip to content

Commit

Permalink
Checkbox Example Added
Browse files Browse the repository at this point in the history
  • Loading branch information
nasirkhan committed Oct 9, 2019
1 parent 8fbce10 commit bcb20a1
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
11 changes: 10 additions & 1 deletion config/setting_fields.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@
'class' => '', // any class for input
'value' => '<a href="https://github.com/nasirkhan/laravel-starter/">Built with ♥ from Bangladesh</a>', // default value if you want
],
[
'type' => 'checkbox', // input fields type
'data' => 'text', // data type, string, int, boolean
'name' => 'show_copyright', // unique name for field
'label' => 'Show Copyright', // you know what label it is
'rules' => '', // validation rule of laravel
'class' => '', // any class for input
'value' => '1', // default value if you want
]
],
],
'email' => [
Expand Down Expand Up @@ -158,7 +167,7 @@
'rules' => '', // validation rule of laravel
'class' => '', // any class for input
'value' => '@nasir8891', // default value if you want
],
]
],

],
Expand Down
2 changes: 1 addition & 1 deletion resources/views/backend/includes/header.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
<a class="dropdown-item" href="{{route('backend.users.profile', Auth::user()->id)}}">
<i class="fas fa-at"></i> {{ Auth::user()->email }}
</a>
<a class="dropdown-item" href="{{ route("backend.$module_name.index") }}">
<a class="dropdown-item" href="{{ route("backend.notifications.index") }}">
<i class="fa fa-bell"></i> Notifications
<span class="badge badge-warning">{{$notifications_count}}</span>
</a>
Expand Down
14 changes: 13 additions & 1 deletion resources/views/backend/settings/fields/checkbox.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div class="form-group {{ $errors->has($field['name']) ? ' has-error' : '' }}">
<!-- <div class="form-group {{ $errors->has($field['name']) ? ' has-error' : '' }}">
<div class="checkbox">
<label>
<input name="{{ $field['name'] }}" value="1" type="checkbox" @if(old($field['name'], setting($field['name']))) checked="checked" @endif >
Expand All @@ -7,4 +7,16 @@
@if ($errors->has($field['name'])) <small class="invalid-feedback">{{ $errors->first($field['name']) }}</small> @endif
</div>
</div> -->

<div class="form-group {{ $errors->has($field['name']) ? ' has-error' : '' }}">
<div class="checkbox">
<label>
<input type='hidden' value='0' name='{{ $field['name'] }}'>
<input name="{{ $field['name'] }}" value="{{ \Illuminate\Support\Arr::get($field, 'value', '1') }}" type="checkbox" @if(old($field['name'], setting($field['name']))) checked="checked" @endif >
{{ $field['label'] }}
</label>

@if ($errors->has($field['name'])) <small class="help-block">{{ $errors->first($field['name']) }}</small> @endif
</div>
</div>

0 comments on commit bcb20a1

Please sign in to comment.