2016-03-05 00:18:10 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
2016-02-29 15:59:36 +00:00
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
Attendize.com - Event Management & Ticketing
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
/**
|
2016-03-05 00:18:10 +00:00
|
|
|
* Description of Message.
|
2016-02-29 15:59:36 +00:00
|
|
|
*
|
|
|
|
|
* @author Dave
|
|
|
|
|
*/
|
2016-03-05 00:18:10 +00:00
|
|
|
class Message extends MyBaseModel
|
|
|
|
|
{
|
2016-03-11 01:03:33 +00:00
|
|
|
|
|
|
|
|
protected $fillable = [
|
|
|
|
|
'message',
|
|
|
|
|
'subject',
|
|
|
|
|
'recipients',
|
|
|
|
|
];
|
|
|
|
|
|
2016-03-05 00:18:10 +00:00
|
|
|
public function event()
|
|
|
|
|
{
|
2016-02-29 15:59:36 +00:00
|
|
|
return $this->belongsTo('\App\Models\Event');
|
|
|
|
|
}
|
2016-03-05 00:18:10 +00:00
|
|
|
|
|
|
|
|
public function getRecipientsLabelAttribute()
|
|
|
|
|
{
|
|
|
|
|
if ($this->recipients == 0) {
|
2016-02-29 15:59:36 +00:00
|
|
|
return 'All Attendees';
|
|
|
|
|
}
|
2016-03-05 00:18:10 +00:00
|
|
|
|
2016-02-29 15:59:36 +00:00
|
|
|
$ticket = Ticket::scope()->find($this->recipients);
|
2016-03-05 00:18:10 +00:00
|
|
|
|
2016-02-29 15:59:36 +00:00
|
|
|
return 'Ticket: '.$ticket->title;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-05 00:18:10 +00:00
|
|
|
public function getDates()
|
|
|
|
|
{
|
|
|
|
|
return ['created_at', 'updated_at', 'sent_at'];
|
|
|
|
|
}
|
2016-02-29 15:59:36 +00:00
|
|
|
}
|