Added Notifications

This commit is contained in:
2026-05-19 21:45:24 +10:00
parent 3bd2bda84c
commit 3eb3971d79
202 changed files with 90 additions and 15 deletions
@@ -47,6 +47,25 @@ class AirlineApiController extends ApiController
return $this->getAirlineLogo($airline);
}
public function getLivery(string $airlineInternalName, string $aircraftDesignator){
$path = "images/liveries/{$airlineInternalName}_{$aircraftDesignator}.png";
$cacheLimit = 60 * 60 * 72;
if(!Storage::disk('local')->exists($path)){
return response()->json(['error' => 'Livery not found'], 404);
}
$fullPath = Storage::disk('local')->path($path);
$lastModified = filemtime($fullPath);
return response()->file($fullPath, [
'Content-Type' => 'image/png',
'Cache-Control' => 'public, max-age='.$cacheLimit, // 24 hours
'Last-Modified' => gmdate('D, d M Y H:i:s', $lastModified) . ' GMT',
'ETag' => md5($path . $lastModified),
]);
}
function parseAirlineData(Airline $airline){
$countryCode = $airline->country->code;
+9
View File
@@ -3,6 +3,7 @@
namespace App\Http\Controllers;
use App\Models\Followee;
use App\Models\Notification;
use App\Models\User;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
@@ -26,6 +27,14 @@ class UserController extends Controller
'followee_id' => $user->id,
]);
Notification::create([
'user_id' => $user->id,
'title' => 'New follower',
'body' => auth()->user()->name . ' is now following you.',
'is_achievement' => false,
'url' => '/u/'. auth()->user()->name,
]);
return response()->json(['following' => true]);
}
}