April 2026 waren Wirtschaft Feedback
This commit is contained in:
parent
02f2a4c23e
commit
9ce711d6b2
167 changed files with 25278 additions and 8518 deletions
75
app/Models/PackagingItem.php
Normal file
75
app/Models/PackagingItem.php
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Database\Factories\PackagingItemFactory;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
class PackagingItem extends Model
|
||||
{
|
||||
/** @use HasFactory<PackagingItemFactory> */
|
||||
use HasFactory, SoftDeletes;
|
||||
|
||||
protected $fillable = [
|
||||
'packaging_material_id',
|
||||
'supplier_id',
|
||||
'name',
|
||||
'category',
|
||||
'weight_grams',
|
||||
'min_stock_alert',
|
||||
'url',
|
||||
'product_id',
|
||||
'active',
|
||||
];
|
||||
|
||||
/**
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'active' => 'boolean',
|
||||
'weight_grams' => 'decimal:2',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<PackagingMaterial, $this>
|
||||
*/
|
||||
public function packagingMaterial(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(PackagingMaterial::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Supplier, $this>
|
||||
*/
|
||||
public function supplier(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Supplier::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return BelongsTo<Product, $this>
|
||||
*/
|
||||
public function product(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Product::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Produkte, die diesen Verpackungsartikel in der Stückliste führen (BOM).
|
||||
*
|
||||
* @return BelongsToMany<Product, $this>
|
||||
*/
|
||||
public function products(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Product::class, 'product_packagings')
|
||||
->withPivot('quantity', 'pos')
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue