tissue/app/Tag.php

38 lines
686 B
PHP
Raw Normal View History

2018-01-08 08:50:22 +09:00
<?php
namespace App;
2020-07-30 22:42:10 +09:00
use App\Utilities\Formatter;
2018-01-08 08:50:22 +09:00
use Illuminate\Database\Eloquent\Model;
class Tag extends Model
{
//
protected $fillable = [
'name'
];
protected $visible = [
'name'
];
2018-01-08 08:50:22 +09:00
2020-07-30 22:42:10 +09:00
protected static function boot()
{
parent::boot();
self::creating(function (Tag $tag) {
$tag->normalized_name = app(Formatter::class)->normalizeTagName($tag->name);
});
}
2018-01-08 08:50:22 +09:00
public function ejaculations()
{
return $this->belongsToMany('App\Ejaculation')->withTimestamps();
}
public function metadata()
{
return $this->belongsToMany('App\Metadata')->withTimestamps();
}
2018-01-08 08:50:22 +09:00
}