Add categories for generic prices
This commit is contained in:
@@ -36,14 +36,17 @@ class PriceGenerics
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return PriceGeneric::find($id);
|
||||
return PriceGeneric::with("values")->find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$price = $id ? self::update($data) : self::create($data);
|
||||
return $price->id;
|
||||
$prices = isset($data['prices']) ? $data['prices'] : false;
|
||||
unset($data['prices']);
|
||||
$generic = $id ? self::update($data) : self::create($data);
|
||||
PriceGenericValues::storePrices($generic->id, $prices);
|
||||
return $generic->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
@@ -54,9 +57,9 @@ class PriceGenerics
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = isset($data['id']) ? $data['id'] : false;
|
||||
$article = PriceGeneric::find($id);
|
||||
$article->update($data);
|
||||
return $article;
|
||||
$generic = PriceGeneric::find($id);
|
||||
$generic->update($data);
|
||||
return $generic;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
|
||||
Reference in New Issue
Block a user