Update Fix
This commit is contained in:
27
app/Models/Produk.php
Normal file
27
app/Models/Produk.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Models\ProductUnit;
|
||||
|
||||
class Produk extends Model
|
||||
{
|
||||
protected $table = 'produk';
|
||||
|
||||
protected $fillable = [
|
||||
'sku',
|
||||
'nama',
|
||||
'barcode',
|
||||
'harga_beli',
|
||||
'harga_jual',
|
||||
'is_aktif',
|
||||
];
|
||||
|
||||
public function units() {
|
||||
return $this->hasMany(ProductUnit::class, 'produk_id');
|
||||
}
|
||||
public function baseUnit() {
|
||||
return $this->hasOne(ProductUnit::class, 'produk_id')->where('is_base', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user