tags.normalized_name
This commit is contained in:
10
app/Tag.php
10
app/Tag.php
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App;
|
||||
|
||||
use App\Utilities\Formatter;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Tag extends Model
|
||||
@@ -15,6 +16,15 @@ class Tag extends Model
|
||||
'name'
|
||||
];
|
||||
|
||||
protected static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
|
||||
self::creating(function (Tag $tag) {
|
||||
$tag->normalized_name = app(Formatter::class)->normalizeTagName($tag->name);
|
||||
});
|
||||
}
|
||||
|
||||
public function ejaculations()
|
||||
{
|
||||
return $this->belongsToMany('App\Ejaculation')->withTimestamps();
|
||||
|
Reference in New Issue
Block a user