51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
use App\Models\TrTransaksi;
|
|
use App\Interfaces\TrTransaksiInterface;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class TrTransaksiRepository implements TrTransaksiInterface
|
|
{
|
|
private $trTransaksi;
|
|
|
|
public function __construct(TrTransaksi $trTransaksi)
|
|
{
|
|
$this->trTransaksi = $trTransaksi;
|
|
}
|
|
|
|
public function getAll()
|
|
{
|
|
return $this->trTransaksi->all();
|
|
}
|
|
|
|
public function getById($id)
|
|
{
|
|
return $this->trTransaksi->find($id);
|
|
}
|
|
|
|
public function getByRegistrasi($id_registrasi)
|
|
{
|
|
return $this->trTransaksi->where('id_registrasi', $id_registrasi)->get();
|
|
}
|
|
|
|
public function getByDate($date)
|
|
{
|
|
return $this->trTransaksi->whereDate('created_at', $date)->get();
|
|
}
|
|
|
|
public function store($data)
|
|
{
|
|
return $this->trTransaksi->create($data);
|
|
}
|
|
|
|
public function update($id, $data)
|
|
{
|
|
return $this->trTransaksi->find($id)->update($data);
|
|
}
|
|
|
|
public function delete($id)
|
|
{
|
|
return $this->trTransaksi->find($id)->delete();
|
|
}
|
|
} |