Customer Mail, Mails, Views Lead Customer

This commit is contained in:
Kevin Adametz 2020-03-12 09:37:01 +01:00
parent f1e0900a7a
commit f53f17f9c1
46 changed files with 2217 additions and 1489 deletions

View file

@ -11,13 +11,20 @@ use Reliese\Database\Eloquent\Model;
/**
* Class CMSAuthor
*
*
* @property int $id
* @property string $name
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CMSAuthor whereUpdatedAt($value)
* @mixin \Eloquent
*/
class CMSAuthor extends Model
{

View file

@ -121,39 +121,32 @@ class Customer extends Model
'participants_remarks',
'miscellaneous_remarks',
'country_id',
];
public function travel_country()
{
return $this->belongsTo(TravelCountry::class, 'country_id');
}
public function credit_card_type()
{
return $this->belongsTo(CreditCardType::class);
}
public function salutation()
{
return $this->belongsTo(Salutation::class);
}
public function bookings()
{
return $this->hasMany(Booking::class);
}
public function coupons()
{
return $this->hasMany(Coupon::class);
}
public function leads()
{
return $this->hasMany(Lead::class);
}
public function fullName()
{
if ($this->firstname) {
@ -161,7 +154,6 @@ class Customer extends Model
}
return $this->name;
}
}

109
app/Models/CustomerMail.php Normal file
View file

@ -0,0 +1,109 @@
<?php
/**
* Created by Reliese Model.
*/
namespace App\Models;
use Carbon\Carbon;
use Reliese\Database\Eloquent\Model;
/**
* Class CustomerMail
*
* @property int $id
* @property int $booking_id
* @property int $customer_id
* @property int $lead_id
* @property string $subject
* @property string $message
* @property bool $send
* @property bool $fail
* @property string $error
* @property Carbon $sent_at
* @property Carbon $scheduled_at
* @property Carbon $delivered_at
* @property Carbon $created_at
* @property Carbon $updated_at
* @property Booking $booking
* @property Customer $customer
* @property Lead $lead
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereBookingId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereCustomerId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereDeliveredAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereError($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereFail($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereLeadId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereMessage($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereScheduledAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSend($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSentAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereSubject($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\CustomerMail whereUpdatedAt($value)
* @mixin \Eloquent
*/
class CustomerMail extends Model
{
protected $table = 'customer_mails';
protected $casts = [
'booking_id' => 'int',
'customer_id' => 'int',
'lead_id' => 'int',
'send' => 'bool',
'fail' => 'bool'
];
protected $dates = [
'sent_at',
'scheduled_at',
'delivered_at'
];
protected $fillable = [
'booking_id',
'customer_id',
'lead_id',
'email',
'subject',
'message',
'send',
'fail',
'error',
'sent_at',
'scheduled_at',
'delivered_at'
];
public function booking()
{
return $this->belongsTo(Booking::class);
}
public function customer()
{
return $this->belongsTo(Customer::class);
}
public function lead()
{
return $this->belongsTo(Lead::class);
}
public function getSentAtAttribute(){
if(!$this->attributes['sent_at']){ return ""; }
return Carbon::parse($this->attributes['sent_at'])->format(\Util::formatDateTimeDB());
}
public function getCreatedAtAttribute(){
if(!$this->attributes['created_at']){ return ""; }
return Carbon::parse($this->attributes['created_at'])->format(\Util::formatDateTimeDB());
}
}

View file

@ -11,13 +11,20 @@ use Reliese\Database\Eloquent\Model;
/**
* Class Keyword
*
*
* @property int $id
* @property string $name
* @property Carbon $created_at
* @property Carbon $updated_at
*
* @package App\Models
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword newModelQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword newQuery()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword query()
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword whereCreatedAt($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword whereId($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword whereName($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Keyword whereUpdatedAt($value)
* @mixin \Eloquent
*/
class Keyword extends Model
{

View file

@ -48,6 +48,9 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide whereBoxImageUrl($value)
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide whereCountryId($value)
* @property-read int|null $iq_content_sites_count
* @property int|null $author_id
* @property-read \App\Models\CMSAuthor|null $author
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelGuide whereAuthorId($value)
*/
class TravelGuide extends Model
{
@ -98,7 +101,7 @@ class TravelGuide extends Model
public function author()
{
return $this->belongsTo('App\Models\Author', 'author_id', 'id');
return $this->belongsTo('App\Models\CMSAuthor', 'author_id', 'id');
}
public static function getScopeOptions($setKey = false){

View file

@ -111,6 +111,8 @@ use Illuminate\Database\Eloquent\Model;
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram query()
* @property-read int|null $classes_count
* @property-read int|null $travel_program_drafts_count
* @property string|null $keywords
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgram whereKeywords($value)
*/
class TravelProgram extends Model
{