Undangan/backend-baru/app/Models/Pelanggan.php
2025-10-22 17:09:41 +07:00

40 lines
718 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Pelanggan extends Model
{
use HasFactory;
protected $table = 'pelanggans';
protected $fillable = [
'nama_pemesan',
'email',
'no_tlpn',
'template_id',
'form',
'harga',
'status',
'kode_pelanggan',
];
protected $casts = [
'form' => 'array',
'harga' => 'decimal:2',
];
public function template()
{
return $this->belongsTo(Template::class, 'template_id');
}
public function guests()
{
return $this->hasMany(Guest::class, 'id_pelanggan');
}
}