54 lines
1.1 KiB
PHP
54 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class StoreInventoryAdjustment extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
public const TYPE_PURCHASE = 'purchase';
|
|
|
|
public const TYPE_SALE = 'sale';
|
|
|
|
public const TYPE_DEFECTIVE = 'defective';
|
|
|
|
public const TYPE_MANUAL = 'manual';
|
|
|
|
public const TYPE_RETURN = 'return';
|
|
|
|
protected $fillable = [
|
|
'store_id',
|
|
'type',
|
|
'quantity',
|
|
'qr_code_id',
|
|
'reason',
|
|
'adjusted_by_user_id',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'quantity' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function store(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PartnerStore::class, 'store_id');
|
|
}
|
|
|
|
public function qrCode(): BelongsTo
|
|
{
|
|
return $this->belongsTo(QrCode::class);
|
|
}
|
|
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'adjusted_by_user_id');
|
|
}
|
|
}
|