Updated logo API

This commit is contained in:
2026-04-23 21:32:25 +10:00
parent 110ed5b984
commit 678096b463
22 changed files with 638 additions and 146 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ 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/";
return config('app.logo_api_url') . "/airline/$this->internal_name/logo/tail";
}
);
}
+24
View File
@@ -0,0 +1,24 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Followee extends Model
{
protected $fillable = [
'user_id',
'followee_id',
];
public function user(): BelongsTo
{
return $this->belongsTo(User::class, 'user_id');
}
public function followee(): BelongsTo
{
return $this->belongsTo(User::class, 'followee_id');
}
}
+26
View File
@@ -3,6 +3,7 @@
namespace App\Models;
// use Illuminate\Contracts\Auth\MustVerifyEmail;
use App\Http\Controllers\UserFlightController;
use Database\Factories\UserFactory;
use Illuminate\Database\Eloquent\Attributes\Fillable;
use Illuminate\Database\Eloquent\Attributes\Hidden;
@@ -32,6 +33,16 @@ class User extends Authenticatable
];
}
public function resolveRouteBinding($value, $field = null): ?User
{
return $this->where('name', 'ilike', $value)->firstOrFail();
}
public function FlightController(): UserFlightController
{
return new UserFlightController($this);
}
public function flights(): HasMany {
return $this->hasMany(UserFlight::class);
}
@@ -40,4 +51,19 @@ class User extends Authenticatable
{
return $this->hasMany(ImportedFlight::class);
}
public function following(): HasMany
{
return $this->hasMany(Followee::class, 'user_id');
}
public function followers(): HasMany
{
return $this->hasMany(Followee::class, 'followee_id');
}
public function isFollowing(User $user): bool
{
return $this->following()->where('followee_id', $user->id)->exists();
}
}
+20
View File
@@ -0,0 +1,20 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class UserAction extends Model
{
protected $fillable = [
'user_id',
'user_flight_id',
'message',
];
protected $casts = [
'user_flight_id' => 'integer',
'user_id' => 'integer',
'message' => 'string',
];
}