Files
api-extranetwork/app/Models/Offer.php
ExtraNetwork e5c4b6aa13 first commit
2026-05-12 17:04:54 +03:00

131 lines
3.3 KiB
PHP

<?php
namespace App\Models;
class Offer extends BaseModel
{
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'offer';
protected $appends = [];
const CREATED_AT = 'created_at';
const UPDATED_AT = 'updated_at';
protected $dateFormat = 'U';
protected $guarded = [];
/**
* The attributes excluded from the model's JSON form.
*
* @var array
*/
protected $hidden = [];
/**
* @return mixed
*/
public function offerAccommodationMapping()
{
return $this->hasMany('App\Models\OfferAccommodationMapping', 'offer_id', 'id')->select("id", "offer_id", "property_accommodation_id");
}
public function offerCancellationPolicy()
{
return $this->hasMany('App\Models\OfferCancellationPolicy', 'offer_id', 'id')->select("id", "offer_id", "days_before", "type", "value");
}
public function offerContactMapping()
{
return $this->hasMany('App\Models\OfferContactMapping', 'offer_id', 'id')
->select("id", "offer_id", "property_executive_id", "status")
->where("status", "=", 1);
}
public function offerFactMapping()
{
return $this->hasMany('App\Models\OfferFactMapping', 'offer_id', 'id')->select("id",
"offer_id",
"category_id",
"property_fact_parent_id",
"property_fact_id"
);
}
public function offerImportantNotes()
{
return $this->hasMany('App\Models\OfferImportantNotes', 'offer_id', 'id')->select("id",
"offer_id",
"note"
);
}
public function offerPhotoMapping()
{
return $this->hasMany('App\Models\OfferPhotoMapping', 'offer_id', 'id')->select("id",
"offer_id",
"property_photo_id",
"is_cover"
);
}
public function offerPrice()
{
return $this->hasMany('App\Models\OfferPrice', 'offer_id', 'id')->select("id",
"offer_id",
"date",
"property_room_id",
"property_accommodation_id",
"number_of_rooms",
"currency",
"amount",
"total_amount"
);
}
public function offerRoomMapping()
{
return $this->hasMany('App\Models\OfferRoomMapping', 'offer_id', 'id')->select("id",
"offer_id",
"property_room_id"
);
}
public function offerLanguage()
{
return $this->hasOne('App\Models\Language', 'code', 'language')->select(
"code",
"name",
"language_key"
);
}
public function offerAcceptStatus()
{
return $this->hasOne('App\Models\OfferAcceptStatus', 'id', 'accept_status')->select("id", "name", "language_key");
}
public function createUser()
{
return $this->hasOne('App\Models\User', 'id', 'created_by')->select("id", "name", "surname", "email");
}
public function property()
{
return $this->hasOne("App\Models\Property", 'id', 'property_id')->select(['id', 'name']);
}
public function paymentTransaction()
{
return $this->hasMany('App\Models\PaymentTransaction', 'order_id', 'payment_transaction_order_id')
->select("id", "code", "order_id", "base_amount", "base_currency", "status");
}
}