33 lines
614 B
PHP
33 lines
614 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Produk extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'produks';
|
|
|
|
protected $fillable = [
|
|
'petani_id',
|
|
'nama_produk',
|
|
'kategori',
|
|
'harga',
|
|
'stok',
|
|
'deskripsi',
|
|
'foto_produk'
|
|
];
|
|
|
|
public function petani()
|
|
{
|
|
return $this->belongsTo(Petani::class, 'petani_id');
|
|
}
|
|
|
|
public function detailTransaksis()
|
|
{
|
|
return $this->hasMany(DetailTransaksi::class, 'produk_id');
|
|
}
|
|
} |