release
This commit is contained in:
@ -30,6 +30,7 @@ class Event extends Model
|
||||
public $translatable = ['title', 'body', 'venue', 'contact', 'seo_keyword', 'seo_description'];
|
||||
protected $casts = [
|
||||
'post_at' => 'datetime',
|
||||
'event_at' => 'datetime',
|
||||
'photos' => 'array',
|
||||
];
|
||||
/*
|
||||
|
@ -30,6 +30,7 @@ class HomeCarousel extends Model
|
||||
public $translatable = ['title','body'];
|
||||
protected $casts = [
|
||||
'photos' => 'array',
|
||||
'featured_photos' => 'array',
|
||||
];
|
||||
|
||||
/*
|
||||
@ -40,13 +41,28 @@ class HomeCarousel extends Model
|
||||
public static function boot()
|
||||
{
|
||||
parent::boot();
|
||||
static::creating(function ($model) {
|
||||
$limit = 6;
|
||||
$actualCount = HomeCarousel::query()->count();
|
||||
|
||||
if ($actualCount >= $limit) {
|
||||
return false;
|
||||
}
|
||||
|
||||
});
|
||||
static::deleting(function($obj) {
|
||||
if (count((array)$obj->photos)) {
|
||||
foreach ($obj->photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
if (count((array)$obj->featured_photos)) {
|
||||
foreach ($obj->featured_photos as $item) {
|
||||
\Storage::disk('public')->delete($item['file_path']);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
@ -85,6 +101,14 @@ class HomeCarousel extends Model
|
||||
$disk = "public";
|
||||
$destination_path = "home_carousel";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
public function setFeaturedPhotosAttribute($value)
|
||||
{
|
||||
$attribute_name = "featured_photos";
|
||||
$disk = "public";
|
||||
$destination_path = "home_carousel";
|
||||
|
||||
$this->uploadImgMultipleFilesToDisk($value, $attribute_name, $disk, $destination_path);
|
||||
}
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ class Product extends Model
|
||||
protected $guarded = ['id'];
|
||||
// protected $fillable = [];
|
||||
// protected $hidden = [];
|
||||
public $translatable = ['title', 'tip', 'description', 'body', 'feature_overview', 'feature_spec', 'seo_keyword', 'seo_description'];
|
||||
public $translatable = ['title', 'description', 'body', 'feature_overview', 'feature_spec', 'seo_keyword', 'seo_description'];
|
||||
protected $casts = [
|
||||
'photos' => 'array',
|
||||
];
|
||||
@ -53,6 +53,11 @@ class Product extends Model
|
||||
| RELATIONS
|
||||
|--------------------------------------------------------------------------
|
||||
*/
|
||||
public function productRelateds()
|
||||
{
|
||||
return $this->belongsToMany(Product::class, 'product_product_related', 'product_id', 'product_related_id');
|
||||
}
|
||||
|
||||
public function productCatalog()
|
||||
{
|
||||
return $this->belongsTo(ProductCatalog::class, 'product_catalog_id');
|
||||
|
@ -24,6 +24,10 @@ class User extends Authenticatable
|
||||
'name',
|
||||
'email',
|
||||
'password',
|
||||
'phone',
|
||||
'country',
|
||||
'company',
|
||||
'job_title',
|
||||
];
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user