Added Notifications
This commit is contained in:
@@ -203,6 +203,7 @@ class UpdateDepartedFlights extends Command
|
||||
'user_id' => $flight->user_id,
|
||||
'title' => "Flight {$airlineCode}{$flightNumber} updated",
|
||||
'body' => implode("\n", $changeDescriptions),
|
||||
'url' => '/u/'. $flight->user->name . '/flight/'. $flight->id,
|
||||
]);
|
||||
} else {
|
||||
$this->info("No changes for {$airlineCode}{$flightNumber}");
|
||||
@@ -211,6 +212,7 @@ class UpdateDepartedFlights extends Command
|
||||
'user_id' => $flight->user_id,
|
||||
'title' => "Flight {$airlineCode}{$flightNumber} updated — no changes",
|
||||
'body' => "Your flight was completed and no updates were made to aircraft, registration, or departure/arrival times.",
|
||||
'url' => '/u/'. $flight->user->name . '/flight/'. $flight->id,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Achievement;
|
||||
use App\Models\Country;
|
||||
use App\Models\User;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
@@ -30,4 +31,25 @@ class AchievementController extends Controller
|
||||
'userAchievements' => $userAchievements,
|
||||
]);
|
||||
}
|
||||
|
||||
public function specific(User $user, Achievement $achievement)
|
||||
{
|
||||
$regions = match($achievement->internal_name){
|
||||
'fun_challenges.australian_states' => Country::where('code', 'AU')->first()->regions->toArray(),
|
||||
'fun_challenges.chinese_provinces' => Country::where('code', 'CN')->first()->regions->toArray(),
|
||||
'fun_challenges.canadian_provinces' => Country::where('code', 'CA')->first()->regions->toArray(),
|
||||
'fun_challenges.us_states' => Country::where('code', 'US')->first()->regions->toArray(),
|
||||
default => [],
|
||||
};
|
||||
|
||||
return Inertia::render('Profile/UserAchievement', [
|
||||
'user' => $user,
|
||||
'achievement' => $achievement,
|
||||
'userAchievement' => $user->achievements()->where('achievement_id', $achievement->id)->first(),
|
||||
'isFollowing' => auth()->check() && auth()->user()->isFollowing($user),
|
||||
'flight_api_url' => FlightProfileController::getUserFlightApiURL($user),
|
||||
'regions' => $regions,
|
||||
]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -10,13 +10,17 @@ use Inertia\Inertia;
|
||||
|
||||
class FlightProfileController extends Controller
|
||||
{
|
||||
public static function getUserFlightApiURL(User $user){
|
||||
return '/data/user/'.$user->name.'/flights';
|
||||
}
|
||||
|
||||
public function profileData(User $user, string $view, ?int $selectedFlightId = null) : array {
|
||||
return [
|
||||
'user' => $user,
|
||||
'canEdit' => auth()->check() && auth()->id() === $user->id,
|
||||
'initialView' => $view,
|
||||
'selectedFlightId' => $selectedFlightId,
|
||||
'flight_api_url' => '/data/user/'.$user->name.'/flights',
|
||||
'flight_api_url' => self::getUserFlightApiURL($user),
|
||||
'isFollowing' => auth()->check() && auth()->user()->isFollowing($user),
|
||||
];
|
||||
}
|
||||
|
||||
@@ -39,13 +39,21 @@ class Achievement extends Model
|
||||
'achievement_category_id',
|
||||
'achievement_difficulty_id',
|
||||
'threshold',
|
||||
'has_page',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'has_page' => 'boolean',
|
||||
'progressive' => 'boolean',
|
||||
'threshold' => 'integer',
|
||||
];
|
||||
|
||||
|
||||
public function getRouteKeyName(): string
|
||||
{
|
||||
return 'internal_name';
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------
|
||||
// Relationships
|
||||
// ---------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user