Added Notifications

This commit is contained in:
2026-05-11 23:00:48 +10:00
parent c7fe3268c7
commit 69d72e0912
28 changed files with 2094 additions and 23 deletions
@@ -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),
];
}