01 2020
This commit is contained in:
parent
bed91c4f4a
commit
c8948338bb
122 changed files with 7911 additions and 1639 deletions
|
|
@ -1,40 +1,68 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Created by Reliese Model.
|
||||
*/
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\Eloquent\Collection;
|
||||
use Reliese\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* App\Models\Lead
|
||||
* Class Lead
|
||||
*
|
||||
* @property int $id
|
||||
* @property int $customer_id
|
||||
* @property string $request_date
|
||||
* @property string|null $travelperiod_start
|
||||
* @property string|null $travelperiod_end
|
||||
* @property int|null $travelperiod_length
|
||||
* @property int|null $travelcountry_id
|
||||
* @property int|null $travelagenda_id
|
||||
* @property string|null $remarks
|
||||
* @property Carbon $request_date
|
||||
* @property Carbon $travelperiod_start
|
||||
* @property Carbon $travelperiod_end
|
||||
* @property int $travelperiod_length
|
||||
* @property int $travelcountry_id
|
||||
* @property int $travelagenda_id
|
||||
* @property string $remarks
|
||||
* @property int $sf_guard_user_id
|
||||
* @property int|null $is_closed
|
||||
* @property int|null $initialcontacttype_id
|
||||
* @property int|null $searchengine_id
|
||||
* @property string|null $searchengine_keywords
|
||||
* @property bool $is_closed
|
||||
* @property int $initialcontacttype_id
|
||||
* @property int $searchengine_id
|
||||
* @property string $searchengine_keywords
|
||||
* @property int $status_id
|
||||
* @property string|null $next_due_date
|
||||
* @property int|null $website_id
|
||||
* @property int|null $travelcategory_id
|
||||
* @property \Illuminate\Support\Carbon $created_at
|
||||
* @property \Illuminate\Support\Carbon $updated_at
|
||||
* @property float|null $price
|
||||
* @property int|null $pax
|
||||
* @property string|null $participant_name
|
||||
* @property string|null $participant_firstname
|
||||
* @property string|null $participant_birthdate
|
||||
* @property int|null $participant_salutation_id
|
||||
* @property-read \App\Models\SfGuardUser $sf_guard_user
|
||||
* @property-read \App\Models\Status $status
|
||||
* @property Carbon $next_due_date
|
||||
* @property int $website_id
|
||||
* @property int $travelcategory_id
|
||||
* @property Carbon $created_at
|
||||
* @property Carbon $updated_at
|
||||
* @property float $price
|
||||
* @property int $pax
|
||||
* @property string $participant_name
|
||||
* @property string $participant_firstname
|
||||
* @property Carbon $participant_birthdate
|
||||
* @property int $participant_salutation_id
|
||||
* @property Customer $customer
|
||||
* @property InitialContactType $initial_contact_type
|
||||
* @property Salutation $salutation
|
||||
* @property Searchengine $searchengine
|
||||
* @property SfGuardUser $sf_guard_user
|
||||
* @property Status $status
|
||||
* @property TravelAgenda $travel_agenda
|
||||
* @property TravelCategory $travel_category
|
||||
* @property TravelCountry $travel_country
|
||||
* @property Website $website
|
||||
* @property Collection|Booking[] $bookings
|
||||
* @property Collection|Inquiry[] $inquiries
|
||||
* @property Collection|LeadParticipant[] $lead_participants
|
||||
* @property Collection|Offer[] $offers
|
||||
* @property Collection|StatusHistory[] $status_histories
|
||||
* @package App\Models
|
||||
* @property-read int|null $bookings_count
|
||||
* @property-read int|null $inquiries_count
|
||||
* @property-read int|null $lead_participants_count
|
||||
* @property-read int|null $offers_count
|
||||
* @property-read int|null $status_histories_count
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereCustomerId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereId($value)
|
||||
|
|
@ -62,9 +90,6 @@ use Illuminate\Database\Eloquent\Model;
|
|||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereUpdatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead whereWebsiteId($value)
|
||||
* @mixin \Eloquent
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Lead query()
|
||||
*/
|
||||
class Lead extends Model
|
||||
{
|
||||
|
|
@ -72,13 +97,146 @@ class Lead extends Model
|
|||
|
||||
protected $table = 'lead';
|
||||
|
||||
public function status()
|
||||
protected $casts = [
|
||||
'customer_id' => 'int',
|
||||
'travelperiod_length' => 'int',
|
||||
'travelcountry_id' => 'int',
|
||||
'travelagenda_id' => 'int',
|
||||
'sf_guard_user_id' => 'int',
|
||||
'is_closed' => 'bool',
|
||||
'initialcontacttype_id' => 'int',
|
||||
'searchengine_id' => 'int',
|
||||
'status_id' => 'int',
|
||||
'website_id' => 'int',
|
||||
'travelcategory_id' => 'int',
|
||||
'price' => 'float',
|
||||
'pax' => 'int',
|
||||
'participant_salutation_id' => 'int'
|
||||
];
|
||||
|
||||
protected $dates = [
|
||||
'request_date',
|
||||
'travelperiod_start',
|
||||
'travelperiod_end',
|
||||
'next_due_date',
|
||||
'participant_birthdate'
|
||||
];
|
||||
|
||||
protected $fillable = [
|
||||
'customer_id',
|
||||
'request_date',
|
||||
'travelperiod_start',
|
||||
'travelperiod_end',
|
||||
'travelperiod_length',
|
||||
'travelcountry_id',
|
||||
'travelagenda_id',
|
||||
'remarks',
|
||||
'sf_guard_user_id',
|
||||
'is_closed',
|
||||
'initialcontacttype_id',
|
||||
'searchengine_id',
|
||||
'searchengine_keywords',
|
||||
'status_id',
|
||||
'next_due_date',
|
||||
'website_id',
|
||||
'travelcategory_id',
|
||||
'price',
|
||||
'pax',
|
||||
'participant_name',
|
||||
'participant_firstname',
|
||||
'participant_birthdate',
|
||||
'participant_salutation_id'
|
||||
];
|
||||
|
||||
public function updateNextDueDate($date = false){
|
||||
|
||||
if(!$date){
|
||||
$carbon = Carbon::now();
|
||||
$this->next_due_date = $carbon->modify('+ '.$this->status->handling_days.' days')->format("Y-m-d");
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
public function customer()
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
}
|
||||
|
||||
public function initial_contact_type()
|
||||
{
|
||||
return $this->belongsTo(InitialContactType::class, 'initialcontacttype_id');
|
||||
}
|
||||
|
||||
public function salutation()
|
||||
{
|
||||
return $this->belongsTo(Salutation::class, 'participant_salutation_id');
|
||||
}
|
||||
|
||||
public function searchengine()
|
||||
{
|
||||
return $this->belongsTo(Searchengine::class);
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
{
|
||||
return $this->belongsTo(SfGuardUser::class);
|
||||
}
|
||||
|
||||
public function status()
|
||||
{
|
||||
return $this->belongsTo(Status::class);
|
||||
}
|
||||
|
||||
public function travel_agenda()
|
||||
{
|
||||
return $this->belongsTo(TravelAgenda::class, 'travelagenda_id');
|
||||
}
|
||||
|
||||
public function travel_category()
|
||||
{
|
||||
return $this->belongsTo(TravelCategory::class, 'travelcategory_id');
|
||||
}
|
||||
|
||||
//on crm
|
||||
public function travel_country_crm()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Status', 'status_id', 'id');
|
||||
return $this->belongsTo('App\Models\Sym\TravelCountry', 'travelcountry_id', 'id');
|
||||
}
|
||||
|
||||
public function sf_guard_user()
|
||||
|
||||
//on stern other DB
|
||||
public function travel_country()
|
||||
{
|
||||
return $this->belongsTo('App\Models\SfGuardUser', 'sf_guard_user_id', 'id');
|
||||
return $this->belongsTo('App\Models\TravelCountry', 'travelcountry_id', 'crm_id');
|
||||
}
|
||||
|
||||
|
||||
public function website()
|
||||
{
|
||||
return $this->belongsTo(Website::class);
|
||||
}
|
||||
|
||||
public function bookings()
|
||||
{
|
||||
return $this->hasMany(Booking::class);
|
||||
}
|
||||
|
||||
public function inquiries()
|
||||
{
|
||||
return $this->hasMany(Inquiry::class);
|
||||
}
|
||||
|
||||
public function lead_participants()
|
||||
{
|
||||
return $this->hasMany(LeadParticipant::class);
|
||||
}
|
||||
|
||||
public function offers()
|
||||
{
|
||||
return $this->hasMany(Offer::class);
|
||||
}
|
||||
|
||||
public function status_histories()
|
||||
{
|
||||
return $this->hasMany(StatusHistory::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue