Updated Map View

This commit is contained in:
2026-06-20 22:21:17 +10:00
parent 6fad966b7e
commit 05ca994253
52 changed files with 2038 additions and 803 deletions
+9
View File
@@ -17,4 +17,13 @@ class Country extends Model
{
return $this->hasMany(Region::class);
}
function sortedRegions(): array
{
return $this
->regions()
->orderBy('name')
->get()
->toArray();
}
}
+15
View File
@@ -10,6 +10,11 @@ class Followee extends Model
protected $fillable = [
'user_id',
'followee_id',
'verified',
];
protected $casts = [
'verified' => 'boolean',
];
public function user(): BelongsTo
@@ -21,4 +26,14 @@ class Followee extends Model
{
return $this->belongsTo(User::class, 'followee_id');
}
public function scopeVerified($query)
{
return $query->where('verified', true);
}
public function scopePending($query)
{
return $query->where('verified', false);
}
}
+19 -6
View File
@@ -48,6 +48,10 @@ class User extends Authenticatable
$this->update(['settings' => array_merge($current, $values)]);
}
function updateSetting($settingName, $value) : void{
$this->updateSettings([$settingName => $value]);
}
protected function resolvedSettings(): Attribute
{
return Attribute::make(
@@ -80,11 +84,6 @@ class User extends Authenticatable
return $this->where('name', 'ilike', $value)->firstOrFail();
}
public function FlightController(): UserFlightController
{
return new UserFlightController($this);
}
public function flights(): HasMany {
return $this->hasMany(UserFlight::class);
}
@@ -114,7 +113,21 @@ class User extends Authenticatable
public function isFollowing(User $user): bool
{
return $this->following()->where('followee_id', $user->id)->exists();
return $this->following()
->where('followee_id', $user->id)
->verified()
->exists();
}
public function followStatus(User $user): string
{
$followee = $this->following()->where('followee_id', $user->id)->first();
if (!$followee) {
return 'none';
}
return $followee->verified ? 'following' : 'requested';
}
public function notifications(): HasMany
+23
View File
@@ -48,6 +48,9 @@ class UserFlight extends Model
'duration_display',
'distance',
'livery_url',
'scope',
'range',
'region_range'
];
public function calculateGreatCircleDistance(): float{
@@ -108,6 +111,26 @@ class UserFlight extends Model
);
}
protected function scope(): Attribute
{
return Attribute::make(
get: fn() => $this->departureAirport->region->country_id == $this->arrivalAirport->region->country_id ? 'domestic' : 'international'
);
}
protected function range(): Attribute
{
return Attribute::make(
get: fn() => $this->departureAirport->region->continent_id == $this->arrivalAirport->region->continent_id ? 'intracontinental' : 'intercontinental'
);
}
protected function regionRange(): Attribute
{
return Attribute::make(
get: fn() => $this->departureAirport->region_id == $this->arrivalAirport->region_id ? 'intraregional' : 'interregional'
);
}
protected function arrivalDayDifference(): Attribute
{
return Attribute::make(