2015-01-04 20:56:10 +00:00
|
|
|
<?php
|
|
|
|
|
2015-04-19 08:52:39 +01:00
|
|
|
/*
|
|
|
|
* This file is part of Cachet.
|
|
|
|
*
|
2015-07-06 17:37:01 +01:00
|
|
|
* (c) Alt Three Services Limited
|
2015-04-19 08:52:39 +01:00
|
|
|
*
|
|
|
|
* For the full copyright and license information, please view the LICENSE
|
|
|
|
* file that was distributed with this source code.
|
|
|
|
*/
|
|
|
|
|
2015-01-04 20:56:10 +00:00
|
|
|
namespace CachetHQ\Cachet\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Watson\Validating\ValidatingTrait;
|
|
|
|
|
|
|
|
class ComponentGroup extends Model
|
|
|
|
{
|
2015-03-26 15:07:16 -06:00
|
|
|
use ValidatingTrait;
|
2015-01-04 20:56:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* The validation rules.
|
|
|
|
*
|
|
|
|
* @var string[]
|
|
|
|
*/
|
|
|
|
protected $rules = [
|
|
|
|
'name' => 'required|unique:component_groups',
|
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The fillable properties.
|
|
|
|
*
|
|
|
|
* @var string[]
|
|
|
|
*/
|
2015-05-19 22:52:16 +01:00
|
|
|
protected $fillable = ['name', 'order'];
|
2015-01-04 20:56:10 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* A group can have many components.
|
|
|
|
*
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
*/
|
|
|
|
public function components()
|
|
|
|
{
|
2015-06-16 09:46:29 +01:00
|
|
|
return $this->hasMany(Component::class, 'group_id', 'id');
|
2015-01-04 20:56:10 +00:00
|
|
|
}
|
|
|
|
}
|