Backport Incident Updates from v3.0.0

This commit is contained in:
James Brooks
2016-10-06 17:21:18 +01:00
parent c778ce91c3
commit c94919f1b9
43 changed files with 1834 additions and 85 deletions

View File

@@ -0,0 +1,95 @@
<?php
/*
* This file is part of Cachet.
*
* (c) Alt Three Services Limited
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace CachetHQ\Cachet\Models;
use AltThree\Validator\ValidatingTrait;
use CachetHQ\Cachet\Models\Traits\SortableTrait;
use CachetHQ\Cachet\Presenters\IncidentUpdatePresenter;
use Illuminate\Database\Eloquent\Model;
use McCool\LaravelAutoPresenter\HasPresenter;
/**
* This is the incident update class.
*
* @author James Brooks <james@alt-three.com>
*/
class IncidentUpdate extends Model implements HasPresenter
{
use SortableTrait, ValidatingTrait;
/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
protected $casts = [
'incident_id' => 'int',
'status' => 'int',
'message' => 'string',
'user_id' => 'int',
];
/**
* The fillable properties.
*
* @var string[]
*/
protected $fillable = [
'incident_id',
'status',
'message',
'user_id',
];
/**
* The validation rules.
*
* @var string[]
*/
public $rules = [
'incident_id' => 'int',
'status' => 'required|int',
'message' => 'required|string',
'user_id' => 'required|int',
];
/**
* The sortable fields.
*
* @var string[]
*/
protected $sortable = [
'id',
'status',
'user_id',
];
/**
* Get the incident relation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function incident()
{
return $this->belongsTo(Incident::class);
}
/**
* Get the presenter class.
*
* @return string
*/
public function getPresenterClass()
{
return IncidentUpdatePresenter::class;
}
}