33 lines
783 B
PHP
33 lines
783 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Pinjaman extends Model
|
|
{
|
|
use HasFactory;
|
|
protected $table = 'pinjaman';
|
|
protected $primaryKey = 'id_pinjaman';
|
|
protected $guarded = [];
|
|
protected $casts = [
|
|
'created_at' => 'datetime',
|
|
'updated_at' => 'datetime',
|
|
];
|
|
|
|
public function anggota()
|
|
{
|
|
return $this->belongsTo(Anggota::class, 'id_anggota', 'id_anggota');
|
|
}
|
|
|
|
public function detail_pinjaman()
|
|
{
|
|
return $this->hasMany(DetailPinjaman::class, 'id_pinjaman', 'id_pinjaman');
|
|
}
|
|
|
|
public function history_transaksi()
|
|
{
|
|
return $this->hasMany(HistoryTransaksi::class, 'id_pinjaman', 'id_pinjaman');
|
|
}
|
|
} |