109 lines
3.4 KiB
PHP
109 lines
3.4 KiB
PHP
<?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());
|
|
}
|
|
}
|