mkA~(@^_^@)~PNG  IHDR Ÿ f Õ†C1 sRGB ®Îé gAMA ± üa pHYs à ÃÇo¨d GIDATx^íÜL”÷ð÷Yçªö("Bh_ò«®¸¢§q5kÖ*:þ0A­ºšÖ¥]VkJ¢M»¶f¸±8\k2íll£1]q®ÙÔ‚ÆT p0 belongsTo(Product::class); } /** * Get the spec associated with the RFQ. */ public function __construct(array $attributes = []) { parent::__construct($attributes); $this->multiple_attachment = true; $this->multiple_attachment_usage = ['default', 'bdf-file']; } public function getImageAttribute() { return $this->attachmentRelation()->first(); } /** * Get the branch associated with the RFQ. */ public function branch() { return $this->belongsTo(Branch::class , 'branch_id'); } public function user() { return $this->belongsTo(User::class); } public function vendor() { return $this->belongsTo(User::class,'vendor_id'); } public function rfqSpecs() { return $this->hasMany(RfqsSpecs::class, 'rfq_id'); } /** * Relation to Spec model through RFQSpec. */ public function specs() { return $this->belongsToMany(Spec::class, 'rfqs_specs', 'rfq_id', 'spec_id'); } public function bids(): HasMany { return $this->hasMany(RfqBid::class, 'rfq_id'); // Explicitly set the foreign key. } public function rfqItems() { return $this->hasMany(RfqItem::class , 'rfq_id'); } public function isChecked() { return $this->bids() ->where('vendor_id', auth()->user()->id) ->exists(); // 'rfq_id' is handled by the relationship. } }