'datetime', 'created_at' => 'datetime', 'updated_at' => 'datetime', ]; /** * Get the user that owns the stock batch. */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Get the supplier for the stock batch. */ public function supplier(): BelongsTo { return $this->belongsTo(Supplier::class); } public function stockEntries(): HasMany { return $this->hasMany(StockEntry::class); } public function files() { return $this->hasMany(StockBatchFile::class)->select([ 'id', 'filename', 'file_type', 'stock_batch_id', 'user_id', 'created_at', 'updated_at', ]); } public function statusHistory(): HasMany { return $this->hasMany(StockBatchStatusHistory::class, 'stock_batch_id'); } }