feat: add article and production modules

This commit is contained in:
2026-08-31 13:16:46 +08:00
parent ac3da246b2
commit 5c586a1a95
334 changed files with 34419 additions and 1 deletions
@@ -0,0 +1,42 @@
<?php
declare(strict_types=1);
namespace plugin\produce\app\model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Material extends BaseModel
{
protected $table = 'produce_material';
protected $appends = ['created_date', 'updated_date', 'category_name'];
protected $fillable = [
'id',
'category_id',
'product_code',
'product_name',
'created_by',
'updated_by',
'created_at',
'updated_at',
'deleted_at',
];
protected $casts = [
'created_at' => 'integer',
'updated_at' => 'integer',
'deleted_at' => 'integer',
];
public function category(): BelongsTo
{
return $this->belongsTo(MaterialCategory::class, 'category_id', 'id')->withTrashed();
}
public function getCategoryNameAttribute(): string
{
return (string) ($this->category?->category_name ?? '');
}
}