Cachet/app/Models/ComponentGroup.php
2015-03-20 18:30:45 -06:00

53 lines
1.1 KiB
PHP

<?php
namespace CachetHQ\Cachet\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Watson\Validating\ValidatingTrait;
/**
* @property int $id
* @property string $name
* @property \Carbon\Carbon $created_at
* @property \Carbon\Carbon $updated_at
* @property \Carbon\Carbon $deleted_at
*/
class ComponentGroup extends Model
{
use SoftDeletes, ValidatingTrait;
/**
* The validation rules.
*
* @var string[]
*/
protected $rules = [
'name' => 'required|unique:component_groups',
];
/**
* The fillable properties.
*
* @var string[]
*/
protected $fillable = ['name'];
/**
* The attributes that should be mutated to dates.
*
* @var array
*/
protected $dates = ['deleted_at'];
/**
* A group can have many components.
*
* @return \Illuminate\Database\Eloquent\Relations\HasMany
*/
public function components()
{
return $this->hasMany('CachetHQ\Cachet\Models\Component', 'group_id', 'id');
}
}