Add management of merchandises, enhance imageable trait
This commit is contained in:
@@ -67,7 +67,7 @@ class ArticlesDataTable extends DataTable
|
||||
})
|
||||
->editColumn('thumb', function (Article $article) {
|
||||
$image = Articles::getFullImageByArticle($article);
|
||||
return '<img src="' . Articles::getThumbSrc($image) . '">';
|
||||
return Articles::getThumb($image, false);
|
||||
})
|
||||
->editColumn('article_nature.name', function (Article $article) {
|
||||
return $article->article_nature ? $article->article_nature->name : '';
|
||||
|
||||
@@ -11,7 +11,7 @@ class Botanic
|
||||
{
|
||||
$menu->add('Botanique', ['icon' => 'leaf' ])
|
||||
->id('botanic')
|
||||
->order(5);
|
||||
->order(4);
|
||||
|
||||
$menu->addTo('botanic', 'Familles', [
|
||||
'route' => 'Admin.Botanic.Families.index',
|
||||
|
||||
@@ -10,7 +10,7 @@ class Customers
|
||||
{
|
||||
$menu->add('Clients finaux', ['icon' => 'address-card' ])
|
||||
->id('customers')
|
||||
->order(4);
|
||||
->order(6);
|
||||
|
||||
$menu->addTo('customers', __('customer.customers.name'), [
|
||||
'route' => 'Admin.Shop.Customers.index',
|
||||
|
||||
19
app/Menu/Merchandises.php
Normal file
19
app/Menu/Merchandises.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Menu;
|
||||
|
||||
use Sebastienheyd\Boilerplate\Menu\Builder;
|
||||
|
||||
class Merchandises
|
||||
{
|
||||
public function make(Builder $menu)
|
||||
{
|
||||
$menu->add('Marchandises', ['icon' => 'shopping-bag' ])
|
||||
->id('merchandises')
|
||||
->order(5);
|
||||
|
||||
$menu->addTo('merchandises', __('Marchandises'), [
|
||||
'route' => 'Admin.Shop.Merchandises.index',
|
||||
])->activeIfRoute(['Admin.Shop.Merchandises.*'])->order(1);
|
||||
}
|
||||
}
|
||||
@@ -60,10 +60,6 @@ class Shop
|
||||
$menu->addTo('shop', 'Accueil', [
|
||||
'route' => 'Admin.Shop.Homepages.index',
|
||||
])->activeIfRoute(['Admin.Shop.Homepages.*'])->order(15);
|
||||
|
||||
$menu->addTo('shop', 'Marchandises', [
|
||||
'route' => 'Admin.Shop.Merchandises.index',
|
||||
])->activeIfRoute(['Admin.Shop.Merchandises.*'])->order(16);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,6 @@ class Merchandise extends Model implements HasMedia
|
||||
|
||||
public function tags()
|
||||
{
|
||||
return $this->morphToMany('App\Models\Shop\Tag', 'taggable');
|
||||
return $this->morphToMany(Tag::class, 'taggable');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,34 +16,37 @@ trait Imageable
|
||||
return Medias::getImages(self::get($id));
|
||||
}
|
||||
|
||||
public static function getThumb($image)
|
||||
public static function getThumb($image, $with_undefined = true)
|
||||
{
|
||||
return '<img src="' . self::getThumbSrc($image) . '">';
|
||||
$src = self::getThumbSrc($image, $with_undefined);
|
||||
return $src ? "<img src='$src'>" : '';
|
||||
}
|
||||
|
||||
public static function getThumbSrc($image)
|
||||
public static function getThumbSrc($image, $with_undefined = true)
|
||||
{
|
||||
return $image ? Medias::getThumbSrc($image) : '/img/visuel-non-disponible.jpg';
|
||||
return $image ? Medias::getThumbSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' : '');
|
||||
}
|
||||
|
||||
public static function getPreview($image)
|
||||
public static function getPreview($image, $with_undefined = true)
|
||||
{
|
||||
return '<img src="' . self::getPreviewSrc($image) . '" class="img-fluid">';
|
||||
$src = self::getPreviewSrc($image, $with_undefined);
|
||||
return $src ? "<img src='$src' class='img-fluid'>" : '';
|
||||
}
|
||||
|
||||
public static function getPreviewSrc($image)
|
||||
public static function getPreviewSrc($image, $with_undefined = true)
|
||||
{
|
||||
return $image ? Medias::getPreviewSrc($image) : '/img/visuel-non-disponible.jpg';
|
||||
return $image ? Medias::getPreviewSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' :'');
|
||||
}
|
||||
|
||||
public static function getImage($image)
|
||||
public static function getImage($image, $with_undefined = true)
|
||||
{
|
||||
return '<img src="' . self::getImageSrc($image) . '" class="img-fluid">';
|
||||
$src = self::getImageSrc($image, $with_undefined);
|
||||
return $src ? "<img src='$src' class='img-fluid'>" : '';
|
||||
}
|
||||
|
||||
public static function getImageSrc($image)
|
||||
public static function getImageSrc($image, $with_undefined = true)
|
||||
{
|
||||
return $image ? Medias::getImageSrc($image) : '/img/visuel-non-disponible.jpg';
|
||||
return $image ? Medias::getImageSrc($image) : ($with_undefined ? '/img/visuel-non-disponible.jpg' : '');
|
||||
}
|
||||
|
||||
public static function deleteImage($id, $index)
|
||||
|
||||
Reference in New Issue
Block a user