fixes on merchandise
This commit is contained in:
@@ -50,21 +50,22 @@ class Merchandises
|
||||
return Merchandise::find($id);
|
||||
}
|
||||
|
||||
public static function getFull($id)
|
||||
{
|
||||
$data = self::get($id)->toArray();
|
||||
return $data;
|
||||
}
|
||||
|
||||
public static function getTags($id)
|
||||
{
|
||||
return self::get($id)->tags;
|
||||
}
|
||||
|
||||
public static function storeTags($merchandise, $tags)
|
||||
{
|
||||
return Tag::storeTags($merchandise, $tags);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$item = $id ? self::update($data, $id) : self::create($data);
|
||||
return $item->id;
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function storeFull($data)
|
||||
@@ -79,6 +80,11 @@ class Merchandises
|
||||
return $merchandise;
|
||||
}
|
||||
|
||||
public static function storeTags($merchandise, $tags)
|
||||
{
|
||||
return Tag::storeTags($merchandise, $tags);
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return Merchandise::create($data);
|
||||
|
||||
@@ -8,6 +8,11 @@ use App\Models\Shop\Tag;
|
||||
class Tags
|
||||
{
|
||||
|
||||
public static function getTagHtml($tag)
|
||||
{
|
||||
return '<span class="btn btn-xs btn-secondary pb-2">' . self::getFullnameByTag($tag) . '</span>';
|
||||
}
|
||||
|
||||
public static function getOptions()
|
||||
{
|
||||
return Tag::pluck('name', 'id')->toArray();
|
||||
|
||||
Reference in New Issue
Block a user