From 32e19fb4e5be11b3a7823f2e9c697aae0eec49bf Mon Sep 17 00:00:00 2001 From: Kelvin Zhang Date: Mon, 31 Aug 2015 13:53:22 +0100 Subject: [PATCH] Fix SlugTrait --- app/Track.php | 2 +- app/Traits/SlugTrait.php | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/app/Track.php b/app/Track.php index 28ba9eed..2cc94a5a 100644 --- a/app/Track.php +++ b/app/Track.php @@ -2,6 +2,7 @@ namespace App; +use App\Traits\SlugTrait; use Exception; use External; use getid3_writetags; @@ -15,7 +16,6 @@ use Illuminate\Support\Facades\DB; use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\URL; use Illuminate\Support\Str; -use Traits\SlugTrait; class Track extends Model { diff --git a/app/Traits/SlugTrait.php b/app/Traits/SlugTrait.php index 20e86b0e..8868bf5a 100644 --- a/app/Traits/SlugTrait.php +++ b/app/Traits/SlugTrait.php @@ -1,12 +1,14 @@ slug = Str::slug($value); - $this->attributes['title'] = $value; - } - } \ No newline at end of file +trait SlugTrait +{ + public function setTitleAttribute($value) + { + $this->slug = Str::slug($value); + $this->attributes['title'] = $value; + } +} \ No newline at end of file