Cachet is now a Laravel 5 app
This commit is contained in:
44
app/Models/MetricPoint.php
Normal file
44
app/Models/MetricPoint.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace CachetHQ\Cachet\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property int $metric_id
|
||||
* @property int $value
|
||||
* @property \Carbon\Carbon $created_at
|
||||
* @property \Carbon\Carbon $updated_at
|
||||
*/
|
||||
class MetricPoint extends Model
|
||||
{
|
||||
use ValidatingTrait;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $fillable = ['metric_id', 'value'];
|
||||
|
||||
/**
|
||||
* The validation rules.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $rules = [
|
||||
'value' => 'numeric|required',
|
||||
];
|
||||
|
||||
/**
|
||||
* A metric point belongs to a metric unit.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
*/
|
||||
public function metric()
|
||||
{
|
||||
return $this->belongsTo('CachetHQ\Cachet\Models\Metric', 'id', 'metric_id');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user