Restructure batch origins: nested entries per ingredient with Supplier/Farmer selects
Deploy / deploy (push) Successful in 14s
Deploy / deploy (push) Successful in 14s
Each BatchOrigin (spice) now has multiple BatchOriginEntry rows, replacing the flat single-supplier/farmer fields. Lieferant and Landwirt are Select fields backed by dedicated tables with inline create support. Migration preserves existing data. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
400237aa5b
commit
4a98beeb45
6 files changed
+221
-89
No files matched your search
@@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class BatchOrigin extends Model
|
||||
{
|
||||
protected $fillable = ['batch_id', 'spice_id', 'supplier_id', 'origin_country', 'farmer', 'notes'];
|
||||
protected $fillable = ['batch_id', 'spice_id'];
|
||||
|
||||
public function batch()
|
||||
{
|
||||
@@ -18,8 +18,8 @@ class BatchOrigin extends Model
|
||||
return $this->belongsTo(Spice::class);
|
||||
}
|
||||
|
||||
public function supplier()
|
||||
public function entries()
|
||||
{
|
||||
return $this->belongsTo(Supplier::class);
|
||||
return $this->hasMany(BatchOriginEntry::class);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user