44 lines
1.0 KiB
PHP
44 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Collection;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string $internal_name
|
|
* @property string $name
|
|
* @property string $description
|
|
*
|
|
* @property-read Collection<int, Achievement> $achievements
|
|
*/
|
|
class AchievementCategory extends Model
|
|
{
|
|
const array ORDER = [
|
|
'number_of_flights',
|
|
'distance',
|
|
'general_flying',
|
|
'countries_and_continents',
|
|
'aircraft',
|
|
'airlines_and_alliances',
|
|
'fun_challenges',
|
|
];
|
|
|
|
protected $fillable = [
|
|
'internal_name',
|
|
'name',
|
|
'description',
|
|
];
|
|
|
|
// ---------------------------------------------------------------
|
|
// Relationships
|
|
// ---------------------------------------------------------------
|
|
|
|
public function achievements(): HasMany
|
|
{
|
|
return $this->hasMany(Achievement::class, 'achievement_category_id');
|
|
}
|
|
}
|