Synchro back-office, fix on tariffs
This commit is contained in:
@@ -5,7 +5,7 @@ namespace App\Repositories\Shop;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
use App\Repositories\Core\Tag;
|
||||
use App\Repositories\Core\Media;
|
||||
use App\Repositories\Core\Medias;
|
||||
use App\Repositories\Core\Comments;
|
||||
use App\Repositories\Botanic\Species;
|
||||
use App\Repositories\Botanic\Varieties;
|
||||
@@ -74,7 +74,7 @@ class Articles
|
||||
|
||||
public static function getInherited($id)
|
||||
{
|
||||
$article = Article::with('product.tags')->findOrFail($id);
|
||||
$article = Article::with('product.tags.group')->findOrFail($id);
|
||||
$product_type = $article->product_type;
|
||||
switch ($product_type) {
|
||||
case 'App\Models\Botanic\Variety':
|
||||
@@ -245,26 +245,31 @@ class Articles
|
||||
|
||||
public static function storeImages($article, $files)
|
||||
{
|
||||
return Media::storeImages($article, $files);
|
||||
return Medias::storeImages($article, $files);
|
||||
}
|
||||
|
||||
public static function storeImage($article, $file)
|
||||
{
|
||||
return Media::storeImage($article, $file);
|
||||
return Medias::storeImage($article, $file);
|
||||
}
|
||||
|
||||
public static function getImages($id)
|
||||
{
|
||||
return Media::getImages(self::get($id));
|
||||
return Medias::getImages(self::get($id));
|
||||
}
|
||||
|
||||
public static function getThumbSrc($image)
|
||||
{
|
||||
return Media::getThumbSrc($image);
|
||||
return Medias::getThumbSrc($image);
|
||||
}
|
||||
|
||||
public static function getPreviewSrc($image)
|
||||
{
|
||||
return Medias::getPreviewSrc($image);
|
||||
}
|
||||
|
||||
public static function deleteImage($id, $index)
|
||||
{
|
||||
return Media::deleteImage(self::get($id), $index);
|
||||
return Medias::deleteImage(self::get($id), $index);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ class Categories
|
||||
return Category::with('CategoryTree')->find($id);
|
||||
}
|
||||
|
||||
public static function getByCategory($category_id)
|
||||
{
|
||||
return Category::byCategory($category_id)->first();
|
||||
}
|
||||
|
||||
public static function getTree()
|
||||
{
|
||||
return CategoryTrees::getTree();
|
||||
|
||||
@@ -6,14 +6,15 @@ use App\Models\Shop\Offer;
|
||||
|
||||
class Offers
|
||||
{
|
||||
public static function getOptions()
|
||||
|
||||
public static function getLast()
|
||||
{
|
||||
return Offer::orderBy('value', 'asc')->get()->pluck('value', 'id')->toArray();
|
||||
return Offer::with(['article.image'])->orderByDesc('updated_at')->get();
|
||||
}
|
||||
|
||||
public static function getOptionsByPackage($package_id)
|
||||
|
||||
public static function getByCategory($category_id)
|
||||
{
|
||||
return Offer::byPackage($package_id)->orderBy('value', 'asc')->get()->pluck('value', 'id')->toArray();
|
||||
return Offer::with(['article.image'])->byCategory($category_id)->get();
|
||||
}
|
||||
|
||||
public static function getAll()
|
||||
|
||||
@@ -29,6 +29,12 @@ class Tags
|
||||
return Tag::orderBy('order', 'asc')->get();
|
||||
}
|
||||
|
||||
public static function getFullname($id)
|
||||
{
|
||||
$tag = Tag::with('group')->find($id);
|
||||
return $tag->group->name . '-' . $tag->name;
|
||||
}
|
||||
|
||||
public static function get($id)
|
||||
{
|
||||
return Tag::find($id);
|
||||
|
||||
Reference in New Issue
Block a user