Initial commit
Some checks failed
Deploy / deploy (push) Has been cancelled

This commit is contained in:
ssww23
2026-03-10 00:55:37 +03:00
parent fc0f28d830
commit 93a655235a
155 changed files with 24768 additions and 0 deletions

69
app/Models/HomeSlide.php Normal file
View File

@@ -0,0 +1,69 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class HomeSlide extends Model
{
use HasFactory;
protected $fillable = [
'zone',
'title',
'show_title',
'subtitle',
'show_subtitle',
'button_text',
'button_url',
'show_button',
'image_path',
'sort_order',
'is_active',
];
protected function casts(): array
{
return [
'show_title' => 'boolean',
'show_subtitle' => 'boolean',
'show_button' => 'boolean',
'sort_order' => 'integer',
'is_active' => 'boolean',
];
}
public function scopeActive($query)
{
return $query->where('is_active', true);
}
public function scopeForZone($query, string $zone)
{
return $query->where('zone', $zone);
}
public function scopeOrdered($query)
{
return $query->orderBy('sort_order')->orderBy('id');
}
public function getImageUrlAttribute(): ?string
{
if (!$this->image_path) {
return null;
}
if (Str::startsWith($this->image_path, ['http://', 'https://', '/'])) {
return $this->image_path;
}
if (Str::startsWith($this->image_path, 'uploads/')) {
return asset($this->image_path);
}
return '/storage/' . ltrim($this->image_path, '/');
}
}