38 lines
877 B
PHP
38 lines
877 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Notifications\Notifiable;
|
|
use Laravel\Sanctum\HasApiTokens;
|
|
|
|
class Pembayaran extends Model
|
|
{
|
|
use HasApiTokens, HasFactory, Notifiable;
|
|
|
|
protected $fillable = [
|
|
'santri_id', 'tanggal', 'jenis_pembayaran', 'jumlah', 'keterangan', 'status', 'bukti_pembayaran'
|
|
];
|
|
|
|
protected $appends = ['bukti_pembayaran_url'];
|
|
|
|
public function getBuktiPembayaranUrlAttribute()
|
|
{
|
|
if ($this->bukti_pembayaran) {
|
|
return asset('storage/' . $this->bukti_pembayaran);
|
|
}
|
|
return null;
|
|
}
|
|
|
|
public function santri()
|
|
{
|
|
return $this->belongsTo(\App\Models\Santri::class);
|
|
}
|
|
public function kelas()
|
|
{
|
|
return $this->belongsTo(\App\Models\Kelas::class);
|
|
}
|
|
}
|