Initial commit
This commit is contained in:
47
app/Http/Livewire/Description.php
Normal file
47
app/Http/Livewire/Description.php
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Livewire;
|
||||
|
||||
use Livewire\Component;
|
||||
|
||||
class Description extends Component
|
||||
{
|
||||
public $description;
|
||||
public $requiredError = false;
|
||||
|
||||
protected $listeners = ['resetForm'];
|
||||
|
||||
|
||||
/**
|
||||
* Extra check if field is empty on blur textarea
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function checkRequired()
|
||||
{
|
||||
|
||||
$this->dispatch('description', $this->description);
|
||||
|
||||
if ($this->description === null || '')
|
||||
{
|
||||
$this->requiredError = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function resetForm()
|
||||
{
|
||||
$this->description = null;
|
||||
}
|
||||
|
||||
public function updated()
|
||||
{
|
||||
$this->dispatch('description', $this->description);
|
||||
}
|
||||
|
||||
|
||||
public function render()
|
||||
{
|
||||
return view('livewire.description');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user