Updated logo API

This commit is contained in:
2026-04-23 00:53:19 +10:00
parent bd8ef98d30
commit 110ed5b984
17 changed files with 142 additions and 59 deletions
+11
View File
@@ -23,6 +23,7 @@ class Aircraft extends Model
protected $appends = [
'display_name',
'display_name_short'
];
protected function displayName() : Attribute{
@@ -32,4 +33,14 @@ class Aircraft extends Model
}
);
}
protected function displayNameShort(): Attribute
{
return Attribute::make(
get: function () {
$name = "{$this->manufacturer_code} {$this->model_full_name}";
return trim(preg_replace('/\s*\(.*?\)/', '', $name));
}
);
}
}
+9
View File
@@ -29,6 +29,7 @@ class Airline extends Model
public $timestamps = false;
protected $appends = [
'display_name',
'logo_url',
];
protected function displayName() : Attribute{
@@ -41,6 +42,14 @@ class Airline extends Model
);
}
protected function logoUrl() : Attribute{
return Attribute::make(
get: function () {
return config('app.logo_api_url') . "/airline/$this->internal_name/logo/tail/";
}
);
}
public function country(): BelongsTo
{
return $this->belongsTo(Country::class);