fix shipping
This commit is contained in:
@@ -7,13 +7,11 @@ use App\Models\Botanic\Variety;
|
||||
use App\Models\Shop\Article;
|
||||
use App\Models\Shop\ArticleNature;
|
||||
use App\Models\Shop\Merchandise;
|
||||
use App\Traits\Model\Basic;
|
||||
|
||||
class ArticleNatures
|
||||
{
|
||||
public static function getOptions()
|
||||
{
|
||||
return ArticleNature::get()->pluck('name', 'id')->toArray();
|
||||
}
|
||||
use Basic;
|
||||
|
||||
public static function getProductType($id)
|
||||
{
|
||||
@@ -37,12 +35,16 @@ class ArticleNatures
|
||||
switch ($model) {
|
||||
case Specie::class:
|
||||
case Variety::class:
|
||||
return 1;
|
||||
$type = 1;
|
||||
break;
|
||||
case Merchandise::class:
|
||||
return 2;
|
||||
$type = 2;
|
||||
break;
|
||||
default:
|
||||
$type = false;
|
||||
}
|
||||
|
||||
return false;
|
||||
return $type;
|
||||
}
|
||||
|
||||
public static function getProductTypes()
|
||||
@@ -77,14 +79,9 @@ class ArticleNatures
|
||||
return ArticleNature::byProductType($type)->get();
|
||||
}
|
||||
|
||||
public static function getByCategory($category_id)
|
||||
public static function getByCategory($categoryId)
|
||||
{
|
||||
return Article::byCategory($category_id)->select('article_nature_id')->distinct()->get();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
{
|
||||
return ArticleNature::orderBy('name', 'asc')->get();
|
||||
return Article::byCategory($categoryId)->select('article_nature_id')->distinct()->get();
|
||||
}
|
||||
|
||||
public static function getNamesByIds($ids)
|
||||
@@ -94,34 +91,8 @@ class ArticleNatures
|
||||
return array_map('strtolower', $names);
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
public static function getModel()
|
||||
{
|
||||
return ArticleNature::find($id);
|
||||
}
|
||||
|
||||
public static function store($data)
|
||||
{
|
||||
$item = ($data['id'] ?? false) ? self::update($data) : self::create($data);
|
||||
|
||||
return $item->id;
|
||||
}
|
||||
|
||||
public static function create($data)
|
||||
{
|
||||
return ArticleNature::create($data);
|
||||
}
|
||||
|
||||
public static function update($data, $id = false)
|
||||
{
|
||||
$id = $id ? $id : $data['id'];
|
||||
$item = self::get($id);
|
||||
$ret = $item->update($data);
|
||||
|
||||
return $item;
|
||||
}
|
||||
|
||||
public static function destroy($id)
|
||||
{
|
||||
return ArticleNature::destroy($id);
|
||||
return ArticleNature::query();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user