Featured tours working

This commit is contained in:
2025-09-15 13:40:20 +10:00
parent f0e7ce30fc
commit e965cc2780
24 changed files with 384 additions and 26 deletions

27
app/Models/Continent.php Normal file
View File

@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;
use LaravelIdea\Helper\App\Models\_IH_Continent_C;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Continent extends Model
{
protected $fillable = ['name', 'internal_name'];
public $timestamps = false;
public static function allContinentsWithTours(): _IH_Continent_C|Collection|array
{
return Continent::whereHas('countries.tours')
->orderBy('name')
->get();
}
public function countries(): HasMany
{
return $this->hasMany(Country::class);
}
}