Update Fix
This commit is contained in:
51
app/Models/PenerimaanBarang.php
Normal file
51
app/Models/PenerimaanBarang.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class PenerimaanBarang extends Model
|
||||
{
|
||||
protected $table = 'penerimaan_barang';
|
||||
|
||||
protected $fillable = [
|
||||
'nomor_penerimaan',
|
||||
'no_faktur',
|
||||
'tanggal_faktur',
|
||||
'tanggal_datang',
|
||||
'distributor_id',
|
||||
'lokasi_id',
|
||||
'user_id',
|
||||
'status',
|
||||
'catatan',
|
||||
'applied_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'tanggal_faktur' => 'date',
|
||||
'tanggal_datang' => 'date',
|
||||
'applied_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function items(): HasMany
|
||||
{
|
||||
return $this->hasMany(PenerimaanBarangItem::class, 'penerimaan_id');
|
||||
}
|
||||
|
||||
public function distributor(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Distributor::class, 'distributor_id');
|
||||
}
|
||||
|
||||
public function lokasi(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Lokasi::class, 'lokasi_id');
|
||||
}
|
||||
|
||||
public function user(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'user_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user