Viewing file: Draft.php (930 B) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;
class Draft extends Model
{
protected $dates=['schedule_datetime'];
protected $fillable=['numbers','body','emails','schedule_datetime','from_name','reply_to','subject'];
public function setScheduleDatetimeAttribute($value){
$this->attributes['schedule_datetime']=Carbon::createFromTimeString($value);
}
public function getFormattedEmailToAttribute(){
return substr(implode (", ",isset(json_decode($this->emails)->to)?json_decode($this->emails)->to:[]), 0, 1000);
}
public function getFormattedEmailToArrayAttribute(){
return isset(json_decode($this->emails)->to)?json_decode($this->emails)->to:[];
}
public function getFormattedEmailFromAttribute(){
return isset(json_decode($this->emails)->from)?json_decode($this->emails)->from:'';
}
}
|