<?php  namespace App\Models;  use App\Traits\HasStorage; use App\Contracts\HasMedia; use Illuminate\Support\Str; use App\Traits\HasTranslations; use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\Relations\HasMany; use Illuminate\Database\Eloquent\Relations\BelongsTo; use App\Contracts\HasTranslations as ContractsHasTranslations;  /**  * @property-read bool $use_parent_filters  */ class Product extends Model implements ContractsHasTranslations, HasMedia { 	use HasStorage, HasTranslations;  	protected $casts = [ 		'active' => 'boolean', 		'highlighted' => 'boolean', 	];  	public static function generateSlug(string $productTitle, string $productCode): string 	{ 		$original_slug = strtolower(Str::slug($productTitle));  		if (self::where('external_product_id', $productCode)->exists()) { 			return Product::where('external_product_id', $productCode)->first()->slug; 		}  		if (self::where('slug', $original_slug)->exists()) { 			// Add UUID chunk to the end, untill it does not exist 			// if this chunk exists with this ID, try another chunk (won't happen but could happen) 			do { 				$uuid_chunk = explode('-', Str::uuid())[0]; 				$slug = $original_slug . '-' . $uuid_chunk; 			} while (self::where('slug', $slug)->exists()); 			$original_slug = $slug; 		}  		return $original_slug; 	}  	public function defaultTranslationLocale(): string{}  	public function getDefaultMediaPrefix(): string{}  	public function mediaConfig(): array{}  	public function scopeDynamicFilters(Builder $query, ?array $filters = []): Builder{}  	public function scopeDynamicFilter(Builder $query, string $filter_id, array $values): Builder{}  	public function scopeIncludes(object $query, ?string $lang = null): Builder{}  	public function scopeListIncludes(object $query, ?string $lang = null): Builder{}  	public static function getProductByIdOrSlug(string $product, ?string $lang): self 	{ 		return static::includes($lang)->available()->where(function ($query) use ($product) { 			$query->where('id', $product) 				->orWhere('slug', $product) 				->orWhereHas('translations', function ($query) use ($product) { 					$query->where([ 						['column', 'slug'], 						['value', $product], 					]); 				}); 		})->firstOrFail(); 	}  	public function scopeDelivery(Builder $query, ?bool $is_delivery = null): Builder{}  	public function setNameAttribute(?string $value): void{}  	public function setSlugAttribute(?string $value): void{}  	public function getItemName(): string{}  	public function getItemEditRoute(): string{}  	public function scopeAvailable(Builder $query): Builder{}  	public function saveFilterValues(?array $filters = []): self{}  	public function saveFilterTranslations(string $lang, ?array $filters = []): self{}  	public function scopeSearch(Builder $query, ?string $search = null, ?string $lang = null): Builder{}  	public function scopeFilterSortBy(Builder $query, ?string $sort_by = null, ?string $fieldName = null): Builder{}  	public function scopeFilterPriceRange(Builder $query, ?int $price_min = null, ?int $price_max = null): Builder{}  	public function scopeFilterCategory(Builder $query, ?string $category = null): Builder{}  	public function category(): BelongsTo{}  	public function productSibling(): BelongsTo{}  	public function cocktail(): BelongsTo{}  	public function linkedCocktail(): BelongsTo{}  	public function productFilters(): HasMany{}  	public function orderItems(): HasMany{} }