29 lines
600 B
PHP
29 lines
600 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Barang extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'barang';
|
|
protected $guarded = [];
|
|
|
|
public function kategori()
|
|
{
|
|
return $this->belongsTo(Kategori::class, 'id_kategori', 'id');
|
|
}
|
|
|
|
public function listpenjualan()
|
|
{
|
|
return $this->hasMany(ListItemPenjualan::class)->with('barang');;
|
|
}
|
|
public function listpembelian()
|
|
{
|
|
return $this->hasMany(ListItemPembelian::class)->with('barang');;
|
|
}
|
|
}
|