Fixes on tag_Groups and variations, add migrations
This commit is contained in:
@@ -12,14 +12,15 @@ class TagGroupsDataTable extends DataTable
|
||||
|
||||
public function query(TagGroup $model)
|
||||
{
|
||||
$model = $model::withCount('tags');
|
||||
$model = $model::with('article_family')->withCount('tags');
|
||||
return $this->buildQuery($model);
|
||||
}
|
||||
|
||||
protected function getColumns()
|
||||
{
|
||||
return [
|
||||
Column::make('name'),
|
||||
Column::make('code')->title('Code'),
|
||||
Column::make('name')->title('Nom'),
|
||||
Column::make('tags_count')->title('#Tags')->searchable(false)->addClass('text-right')->width(60),
|
||||
$this->makeColumnButtons(),
|
||||
];
|
||||
|
||||
@@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
// use Spatie\Translatable\HasTranslations;
|
||||
use Rinvex\Tags\Models\Tag as parentTag;
|
||||
|
||||
use App\Models\Botanic\Specie;
|
||||
@@ -12,9 +9,16 @@ use App\Models\Botanic\Variety;
|
||||
|
||||
class Tag extends parentTag
|
||||
{
|
||||
// use HasTranslations;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $fillable = [
|
||||
'slug',
|
||||
'name',
|
||||
'description',
|
||||
'sort_order',
|
||||
'group',
|
||||
'tag_group_id',
|
||||
];
|
||||
public $translatable = ['name'];
|
||||
|
||||
/*
|
||||
|
||||
@@ -12,7 +12,7 @@ class Tags
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Tag::get()->pluck('name', 'id')->toArray();
|
||||
return Tag::pluck('name', 'id')->toArray();
|
||||
}
|
||||
|
||||
public static function getWithCountOffers()
|
||||
@@ -52,8 +52,7 @@ class Tags
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data) : self::create($data);
|
||||
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
namespace App\Repositories\Shop;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use App\Models\Shop\Variation;
|
||||
|
||||
class Variations
|
||||
@@ -33,7 +35,7 @@ class Variations
|
||||
|
||||
public static function getName($variation)
|
||||
{
|
||||
return $variation->package->value . ' ' . $variation->quantity . ' ' . ($variation->unity->value ?? null);
|
||||
return $variation->package->value . ' ' . $variation->quantity . ' ' . ($variation->unity->value ?? null) . ' ' . Str::limit($variation->description, 15, ' (...)');
|
||||
}
|
||||
|
||||
public static function buildName($data)
|
||||
|
||||
Reference in New Issue
Block a user