Record used material on tasks and suggest workflow steps' default materials
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
This commit is contained in:
+34
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Modules\Catalog\Infrastructure\Persistence\Eloquent;
|
||||
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Table;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* Persistence model, used only inside the Catalog Infrastructure layer.
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $workflow_template_step_id
|
||||
* @property int $stock_item_id
|
||||
* @property int $quantity_milli
|
||||
* @property int $sort_order
|
||||
*/
|
||||
#[Table('workflow_template_step_materials')]
|
||||
#[Fillable(['workflow_template_step_id', 'stock_item_id', 'quantity_milli', 'sort_order'])]
|
||||
class WorkflowTemplateStepMaterialModel extends Model
|
||||
{
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'workflow_template_step_id' => 'integer',
|
||||
'stock_item_id' => 'integer',
|
||||
'quantity_milli' => 'integer',
|
||||
'sort_order' => 'integer',
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ namespace App\Modules\Catalog\Infrastructure\Persistence\Eloquent;
|
||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
||||
use Illuminate\Database\Eloquent\Attributes\Table;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
/**
|
||||
* Persistence model, used only inside the Catalog Infrastructure layer.
|
||||
@@ -20,6 +21,14 @@ use Illuminate\Database\Eloquent\Model;
|
||||
#[Fillable(['workflow_template_id', 'work_type_id', 'title', 'description', 'sort_order'])]
|
||||
class WorkflowTemplateStepModel extends Model
|
||||
{
|
||||
/**
|
||||
* @return HasMany<WorkflowTemplateStepMaterialModel, $this>
|
||||
*/
|
||||
public function materials(): HasMany
|
||||
{
|
||||
return $this->hasMany(WorkflowTemplateStepMaterialModel::class, 'workflow_template_step_id')->orderBy('sort_order');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user