<?php

/**
 * Created by Reliese Model.
 */

namespace App\Models;

use App\User;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

/**
 * Class UserMessage
 *
 * @property int $id
 * @property int $user_id
 * @property int $send_user_id
 * @property string $email
 * @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 User $user
 * @package App\Models
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereDeliveredAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereEmail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereError($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereFail($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereMessage($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereScheduledAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereSend($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereSendUserId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereSentAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereSubject($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\UserMessage whereUserId($value)
 * @mixin \Eloquent
 */
class UserMessage extends Model
{
	protected $table = 'user_messages';

	protected $casts = [
		'user_id' => 'int',
		'send_user_id' => 'int',
		'send' => 'bool',
		'fail' => 'bool'
	];

	protected $dates = [
		'sent_at',
		'scheduled_at',
		'delivered_at'
	];

	protected $fillable = [
		'user_id',
		'send_user_id',
		'email',
		'subject',
		'message',
		'send',
		'fail',
		'error',
		'sent_at',
		'scheduled_at',
		'delivered_at'
	];

	public function user()
	{
		return $this->belongsTo(User::class);
	}
}
