28 lines
644 B
PHP
28 lines
644 B
PHP
<?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);
|
|
}
|
|
|
|
}
|