distribusi
This commit is contained in:
@@ -10,13 +10,13 @@ class Distribution extends Model
|
||||
{
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $table = 'distributions';
|
||||
protected $table = 'distribusi';
|
||||
|
||||
// Karena id adalah BIGINT auto-increment, default Laravel sudah benar (incrementing = true)
|
||||
protected $fillable = [
|
||||
'petani_id','panen_uid', 'nama_pengirim', 'offtaker_id', 'nama_offtaker',
|
||||
'komoditas_id', 'berat_kg', 'grade_petani', 'grade_offtaker',
|
||||
'alasan_perbedaan_grade', 'harga_per_kg', 'total',
|
||||
'alasan', 'harga_per_kg', 'total',
|
||||
'tgl_distribusi', 'tgl_terima', 'catatan', 'status',
|
||||
'sync_status', 'created_date', 'updated_date',
|
||||
];
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models\Map;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\Pivot;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class PanenKomoditas extends Pivot
|
||||
{
|
||||
use SoftDeletes;
|
||||
|
||||
protected $table = 'panen_komoditas';
|
||||
|
||||
// Penting agar ID auto-increment di tabel pivot terbaca oleh Laravel
|
||||
public $incrementing = true;
|
||||
|
||||
protected $fillable = [
|
||||
'uid',
|
||||
'panen_id',
|
||||
'tanaman_id',
|
||||
'komoditas_id',
|
||||
'berat_kg',
|
||||
'sync_status',
|
||||
];
|
||||
|
||||
public function panen(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Panen::class, 'panen_id');
|
||||
}
|
||||
|
||||
public function tanaman(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Tanaman::class, 'plant_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user