Files
Sistema-Educativo-Laravel/app/Livewire/Conceptos.php
T

45 lines
981 B
PHP

<?php
namespace App\Livewire;
use Carbon\Carbon;
use Livewire\Component;
use App\Models\Concepto;
use Livewire\Attributes\On;
use App\Models\TipoConcepto;
class Conceptos extends Component
{
public $concepto = null;
public $fecha_pago = null;
public $plane;
#[On('edit-concepto')]
public function editMaterial($id)
{
$this->concepto = Concepto::findOrFail($id);
$this->fecha_pago = $this->concepto->fecha_pago
? Carbon::parse($this->concepto->fecha_pago)->format('Y-m-d')
: null;
$this->dispatch('open-concepto-modal');
}
#[On('create-concepto')]
public function createMaterial()
{
$this->reset('concepto');
$this->dispatch('open-concepto-modal');
}
public function render()
{
return view('livewire.conceptos', [
'tipos'=> TipoConcepto::where('id','!=','3')->get(),
'conceptos'=> Concepto::where('tipo','=','3')->get(),
]);
}
}