'json', 'result' => 'json', 'send_type' => 'array', ]; //等待发送中 const SEND_STATUS_WAIT = 0; //发送中 const SEND_STATUS_EXECUTE = 1; //发送完成 const SEND_STATUS_COMPLETE = 2; //发送出错 const SEND_STATUS_ERROR = 2; const SEND_TYPE_SITE = 1; const SEND_TYPE_MAIL = 2; const SEND_TYPE_SMS = 3; /** * The attributes excluded from the model's JSON form. * * @var array */ protected $hidden = []; protected static function booted() { static::saved(function (Message $message) { if ($message->isDirty('send_tag')) { $minutes = Carbon::parse($message->send_time)->diffInMinutes(Carbon::now(), false); if ($minutes) { Queue::later(Carbon::now()->addMinutes($minutes), new SendMessageJob($message->send_tag)); } else { Queue::push(new SendMessageJob($message->send_tag)); } } }); } public function admin() { return $this->belongsTo(Admin::class)->select(['id', 'name', 'username']); } }