Mails etc. in Lead finish
This commit is contained in:
parent
66ca252bfa
commit
b362b93bca
45 changed files with 1460 additions and 418 deletions
|
|
@ -102,13 +102,37 @@ class LeadMail extends Model
|
|||
return $this->belongsTo(Lead::class);
|
||||
}
|
||||
|
||||
public function customer_mail()
|
||||
public function lead_mail()
|
||||
{
|
||||
return $this->belongsTo(CustomerMail::class, 'reply_id');
|
||||
return $this->belongsTo(LeadMail::class, 'reply_id');
|
||||
}
|
||||
|
||||
public function lead_files()
|
||||
{
|
||||
return $this->hasMany(LeadFile::class);
|
||||
}
|
||||
public function getSentAtRaw(){
|
||||
return $this->attributes['sent_at'];
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
public function setForwardMessage($forward = [])
|
||||
{
|
||||
if($forward && is_array($forward)){
|
||||
if(isset($this->forward) && $this->forward){
|
||||
$this->forward = array_merge($this->forward , $forward);
|
||||
}else{
|
||||
$this->forward = $forward;
|
||||
}
|
||||
$this->save();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue