Fixes on tag updating

This commit is contained in:
Ludovic CANDELLIER
2021-08-26 09:54:37 +02:00
parent c3a05640ab
commit cfd8086586
3 changed files with 9 additions and 3 deletions

View File

@@ -3,10 +3,14 @@
namespace App\Models\Shop;
use Illuminate\Database\Eloquent\Model;
use Spatie\Translatable\HasTranslations;
class Tag extends Model
{
use HasTranslations;
protected $guarded = ['id'];
public $translatable = ['name'];
public function group()
{
@@ -20,6 +24,6 @@ class Tag extends Model
public function getNameAttribute($value)
{
return json_decode($value)->fr;
return json_decode($value)->fr ?? false;
}
}