*/ use HasFactory, SoftDeletes; protected $fillable = [ 'name', 'url', 'order_method', 'order_email', 'order_url', 'delivery_time', 'delivery_time_days', 'contact_person', 'email', 'phone', 'country_id', 'notes', 'active', ]; /** * @return array */ protected function casts(): array { return [ 'active' => 'boolean', 'delivery_time_days' => 'integer', ]; } /** * @return BelongsTo */ public function country(): BelongsTo { return $this->belongsTo(Country::class); } /** * @return BelongsToMany */ public function supplierCategories(): BelongsToMany { return $this->belongsToMany( SupplierCategory::class, 'supplier_supplier_category', 'supplier_id', 'supplier_category_id' )->withTimestamps(); } /** * @return HasMany */ public function packagingItems(): HasMany { return $this->hasMany(PackagingItem::class); } /** * @return BelongsToMany */ public function ingredients(): BelongsToMany { return $this->belongsToMany(Ingredient::class, 'ingredient_supplier') ->withPivot(['preferred', 'supplier_sku', 'url']) ->withTimestamps(); } }