mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 21:49:01 +01:00
53 lines
1.1 KiB
PHP
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');
|
|
}
|
|
}
|