Add new version in repository
This commit is contained in:
@@ -3,80 +3,81 @@
|
||||
namespace App\Models\Shop;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
|
||||
use Spatie\Image\Manipulations;
|
||||
use Spatie\MediaLibrary\Models\Media;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMedia;
|
||||
use Spatie\MediaLibrary\HasMedia\HasMediaTrait;
|
||||
|
||||
use Spatie\MediaLibrary\HasMedia;
|
||||
use Spatie\MediaLibrary\InteractsWithMedia;
|
||||
use Spatie\MediaLibrary\MediaCollections\Models\Media;
|
||||
|
||||
use Rinvex\Categories\Traits\Categorizable;
|
||||
use Rinvex\Tags\Traits\Taggable;
|
||||
use Fico7489\Laravel\EloquentJoin\Traits\EloquentJoin;
|
||||
use Wildside\Userstamps\Userstamps;
|
||||
|
||||
class Article extends Model implements HasMedia
|
||||
{
|
||||
use Categorizable, EloquentJoin, HasMediaTrait, Taggable;
|
||||
use Categorizable, EloquentJoin, InteractsWithMedia, Taggable, SoftDeletes, UserStamps;
|
||||
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_articles';
|
||||
protected $guarded = ['id'];
|
||||
protected $table = 'shop_articles';
|
||||
|
||||
public function article_family()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleFamily');
|
||||
}
|
||||
public function article_nature()
|
||||
{
|
||||
return $this->belongsTo('App\Models\Shop\ArticleNature');
|
||||
}
|
||||
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\Media','model_id')->where('model_type','App\Models\Shop\Article');
|
||||
}
|
||||
public function images()
|
||||
{
|
||||
return $this->hasMany('App\Models\Core\Media', 'model_id')->where('model_type', 'App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function image()
|
||||
{
|
||||
return $this->hasOne('App\Models\Core\Media','model_id')->where('model_type','App\Models\Shop\Article');
|
||||
}
|
||||
public function image()
|
||||
{
|
||||
return $this->hasOne('App\Models\Core\Media', 'model_id')->where('model_type', 'App\Models\Shop\Article');
|
||||
}
|
||||
|
||||
public function inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
public function inventories()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Inventory');
|
||||
}
|
||||
|
||||
public function invoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
public function invoiceItems()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\InvoiceItem');
|
||||
}
|
||||
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
public function prices()
|
||||
{
|
||||
return $this->hasMany('App\Models\Shop\Price');
|
||||
}
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
public function product()
|
||||
{
|
||||
return $this->morphTo();
|
||||
}
|
||||
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.id',$id);
|
||||
}
|
||||
public function scopeByArticle($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.id', $id);
|
||||
}
|
||||
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
public function scopeByCategory($query, $category_id)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.article_family_id', $id);
|
||||
}
|
||||
|
||||
public function scopeByFamily($query, $id)
|
||||
{
|
||||
return $query->where('shop_articles.article_family_id',$id);
|
||||
}
|
||||
|
||||
public function registerMediaConversions(Media $media = null)
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
|
||||
}
|
||||
public function registerMediaConversions(Media $media = null) : void
|
||||
{
|
||||
$this->addMediaConversion('thumb')->fit(Manipulations::FIT_CROP, 32, 32);
|
||||
$this->addMediaConversion('mini')->fit(Manipulations::FIT_CROP, 96, 96);
|
||||
$this->addMediaConversion('preview')->fit(Manipulations::FIT_CROP, 160, 160);
|
||||
$this->addMediaConversion('normal')->fit(Manipulations::FIT_CROP, 480, 480);
|
||||
$this->addMediaConversion('zoom')->fit(Manipulations::FIT_CROP, 1200, 1200)->withResponsiveImages();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user