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'
|
|
|
|
];
|
2019-06-24 22:39:01 +09:00
|
|
|
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();
|
|
|
|
}
|
2020-05-16 15:25:03 +09:00
|
|
|
|
|
|
|
public function metadata()
|
|
|
|
{
|
|
|
|
return $this->belongsToMany('App\Metadata')->withTimestamps();
|
|
|
|
}
|
2018-01-08 08:50:22 +09:00
|
|
|
}
|