28 lines
618 B
PHP
28 lines
618 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class WaktuMakan extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'waktu_makans'; // custom table name
|
|
|
|
protected $fillable = ['nama', 'keterangan'];
|
|
|
|
public function makananKomponenWaktu()
|
|
{
|
|
return $this->hasMany(MakananKomponenWaktu::class);
|
|
}
|
|
|
|
public function makanans()
|
|
{
|
|
return $this->belongsToMany(Makanan::class, 'makanan_komponen_waktu')
|
|
->withPivot('komponen_id')
|
|
->withTimestamps();
|
|
}
|
|
}
|