46 lines
1.2 KiB
PHP
46 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class OrderDetail extends Model
|
|
{
|
|
protected $connection = 'dbOrderGizi';
|
|
protected $table = 'public.order_detail';
|
|
public $timestamps = false;
|
|
protected $primaryKey = "order_detail_id";
|
|
protected $fillable =[
|
|
'entry_at',
|
|
'modified_at',
|
|
'statusenabled',
|
|
'master_menu_id',
|
|
'menu_mcu_id',
|
|
'harga_satuan',
|
|
'jumlah',
|
|
'tgl_antar',
|
|
'type',
|
|
'order_id',
|
|
'status_order',
|
|
'karbohidrat_id',
|
|
'catatan',
|
|
'jam_layanan',
|
|
'total_kalori'
|
|
];
|
|
|
|
|
|
|
|
public function menu(){
|
|
return $this->belongsTo(Menu::class, 'master_menu_id', 'master_menu_id')->select('master_menu_id', 'nama_menu', 'foto', 'apakah_someday', 'apakah_mcu');
|
|
}
|
|
public function karbohidrat(){
|
|
return $this->belongsTo(Karbohidrat::class, 'karbohidrat_id', 'karbohidrat_id')->select('karbohidrat_id', 'nama_karbohidrat', 'nilai_kalori');
|
|
}
|
|
public function order(){
|
|
return $this->belongsTo(Order::class, 'order_id', 'order_id');
|
|
}
|
|
public function masterMcu(){
|
|
return $this->belongsTo(MasterMcu::class, 'menu_mcu_id', 'menu_mcu_id');
|
|
}
|
|
}
|