Commit awal: prototipe UI SIAKAD Untan
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
@props(['name', 'label', 'value' => '1', 'checked' => false, 'id' => null])
|
||||
|
||||
@php
|
||||
$id ??= 'check-'.\Illuminate\Support\Str::slug($name);
|
||||
// Setelah validasi gagal, nilai lama menang atas nilai bawaan (kotak yang tidak dicentang tidak dikirim browser)
|
||||
$isChecked = request()->hasSession() && session()->hasOldInput() ? (bool) old($name) : (bool) $checked;
|
||||
@endphp
|
||||
|
||||
<label class="check" for="{{ $id }}">
|
||||
<input
|
||||
type="checkbox"
|
||||
id="{{ $id }}"
|
||||
name="{{ $name }}"
|
||||
value="{{ $value }}"
|
||||
@checked($isChecked)
|
||||
{{ $attributes->class('check__input') }}
|
||||
>
|
||||
<span>{{ $label }}</span>
|
||||
</label>
|
||||
Reference in New Issue
Block a user