mirror of
https://github.com/devcode-it/openstamanager.git
synced 2025-06-05 22:09:38 +02:00
36 lines
856 B
PHP
36 lines
856 B
PHP
<?php
|
|
|
|
namespace App\View\Components\Inputs;
|
|
|
|
use App\View\Components\InputWrapper;
|
|
use Illuminate\View\Component;
|
|
|
|
class Checkbox extends InputWrapper
|
|
{
|
|
public function init()
|
|
{
|
|
$class = $this->get('class');
|
|
|
|
// Rimozione classe CSS predefinita
|
|
$key = $class->search('form-control');
|
|
$class->forget($key);
|
|
|
|
// Correzione valore impostato a boolean
|
|
$value = $this->get('value');
|
|
$this->set([
|
|
'value' => empty($value) || $value == 'off' ? false : true,
|
|
'placeholder' => $this->get('placeholder', $this->get('label')),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get the view / contents that represent the component.
|
|
*
|
|
* @return \Illuminate\Contracts\View\View|string
|
|
*/
|
|
public function render()
|
|
{
|
|
return view('components.inputs.checkbox');
|
|
}
|
|
}
|