Fixes on tag updating
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -55,7 +55,9 @@ class Tags
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
return Tag::find($id)->update($data);
|
||||
$tag = Tag::find($id);
|
||||
$tag->update($data);
|
||||
return $tag;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
@include('components.save')
|
||||
|
||||
@include('load.form.editor.editor')
|
||||
@include('load.form.editor')
|
||||
|
||||
@push('js')
|
||||
<script>
|
||||
|
||||
Reference in New Issue
Block a user