<?php namespace TPS\Birzha\Models;

use Model;

/**
 * Model
 */
class Message extends Model
{
    use \October\Rain\Database\Traits\Validation;

    use \October\Rain\Database\Traits\SoftDelete;

    protected $dates = ['deleted_at'];

    /*
     * Disable timestamps by default.
     * Remove this line if timestamps are defined in the database table.
     */
    public $timestamps = false;


    /**
     * @var string The database table used by the model.
     */
    public $table = 'tps_birzha_messages';

    /**
     * @var array Validation rules
     */
    public $rules = [
    ];

    public $hasOne = [
        'chatroom' => ['TPS\Birzha\Models\Chatroom'],
    ];

    public function scopeReadAtNull($query)
    {
        return $query->where('read_at',null);
    }
}
