items * @property Attachment attachment * @property Supplier supplier * @property ProfitCenter profitCenter * @property HasMany children * @property OrderStatusEnum orderStatus * @property int|null parent_id * @property OrderType orderType */ class OrderArchive extends BaseAuditable { use SelfReferenceTraits; /** * The items that belong to the OrderArchive. */ public function items(): HasMany { return $this->hasMany(OrderArchivesItem::class); } public function attachment(): MorphOne { return $this->morphOne(Attachment::class, 'attachable'); } public function supplier(): BelongsTo { return $this->belongsTo(Supplier::class); } public function profitCenter(): BelongsTo { return $this->belongsTo(ProfitCenter::class); } public function supplierNotifier(): HasMany { return $this->hasMany(SupplierNotifier::class); } public function itemsAPISpecial(): HasMany { return $this->hasMany(OrderArchivesItem::class); // ->with(['ProductGroup']); } public function specialApiData() { /* * 'supplier','profitCenter','itemsx' * Rendelő felületről adatok biztosítása - szállító kódja supplier.hooreycaId - Szállítási dátum deliveryDate - Üzlet kódja profit_center.hooreycaId - Cikk kódja - Mennyiségi egység (árlista L oszlop) - Mértékegység (árlista H oszlop) - Kiszerelés (árlista F oszlop) - Súly/Űrtartalom (árlista G oszlop) - Egységszorzó (árlista K oszlop) - Rendelt mennyiség - Megrendelt cikk nettó értéke */ $ret = $this->query(); // $ret=$ret->select('supplier_id'); // $ret=$ret->with(['supplier'=>function($query){$query->select('hooreycaId');}]); $ret = $ret->with(['supplier' => function ($query) { $query->select('id', 'hooreycaId'); }, 'profitCenter', 'itemsAPISpecial']); // dd($ret->first()); return $ret; } }