42 lines
985 B
PHP
42 lines
985 B
PHP
<?php
|
|
|
|
namespace App\Models\Store;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Dcat\Admin\Traits\HasDateTimeFormatter;
|
|
|
|
class StockLog extends Model
|
|
{
|
|
use HasFactory, HasDateTimeFormatter;
|
|
|
|
protected $table = 'store_stock_logs';
|
|
|
|
protected $fillable = ['administrator_id', 'amount', 'product_sku_id', 'remarks', 'source_id', 'source_type', 'store_id', 'tag_id'];
|
|
|
|
public function store()
|
|
{
|
|
return $this->belongsTo(Store::class, 'store_id');
|
|
}
|
|
|
|
public function productSku()
|
|
{
|
|
return $this->belongsTo(\App\Models\ProductSku::class, 'product_sku_id');
|
|
}
|
|
|
|
public function administrator()
|
|
{
|
|
return $this->belongsTo(\Dcat\Admin\Models\Administrator::class, 'administrator_id');
|
|
}
|
|
|
|
public function source()
|
|
{
|
|
return $this->morphTo();
|
|
}
|
|
|
|
public function tag()
|
|
{
|
|
return $this->belongsTo(\App\Models\Tag::class, 'tag_id');
|
|
}
|
|
}
|