Files
cachet-docker/app/Models/Taggable.php
2018-04-02 17:43:22 +01:00

66 lines
1.3 KiB
PHP

<?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 Illuminate\Database\Eloquent\Model;
/**
* This is the taggable model class.
*
* @author James Brooks <james@alt-three.com>
*/
class Taggable extends Model
{
/**
* The attributes that should be casted to native types.
*
* @var string[]
*/
protected $casts = [
'id' => 'int',
'tag_id' => 'int',
'taggable_id' => 'int',
'taggable_type' => 'string',
];
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'tag_id',
'taggable_id',
'taggable_type',
];
/**
* Get the tag relation.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function tag()
{
return $this->belongsTo(Tag::class);
}
/**
* Get the taggable relation.
*
* @return \Illuminate\Database\Eloquent\Relations\MorphTo
*/
public function taggable()
{
return $this->morphTo();
}
}