- Updated GeneralSettings page to include localized labels and structured sections for better organization. - Enhanced CarouselSlide, Category, Collection, and Product resources with localized model labels and improved form/table configurations. - Modified HomeController to utilize query builder for better performance and added collection items retrieval. - Updated views to reflect localized settings and improved layout for collections and footer. - Adjusted timezone and locale settings in app configuration for better regional support.
27 lines
648 B
PHP
27 lines
648 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Support\Facades\Storage;
|
|
|
|
class CollectionItem extends Model
|
|
{
|
|
protected $fillable = ['collection_id', 'title', 'subtitle', 'image', 'order', 'is_active'];
|
|
|
|
public function collection(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Collection::class);
|
|
}
|
|
|
|
protected static function booted(): void
|
|
{
|
|
static::deleting(function (CollectionItem $item) {
|
|
if ($item->image) {
|
|
Storage::disk('public')->delete($item->image);
|
|
}
|
|
});
|
|
}
|
|
}
|