Added Notifications

This commit is contained in:
2026-05-18 22:06:04 +10:00
parent e1bed676e4
commit 1846cb6a6d
30 changed files with 87 additions and 74 deletions
+9 -6
View File
@@ -7,6 +7,7 @@ use App\Models\UserFlight;
use Illuminate\Console\Attributes\Description;
use Illuminate\Console\Attributes\Signature;
use Illuminate\Console\Command;
use Illuminate\Database\Eloquent\Collection;
#[Signature('app:flight-feed-update')]
#[Description('Command description')]
@@ -14,24 +15,26 @@ class FlightFeedUpdate extends Command
{
public function handle()
{
$time = now('UTC');
$time = now('UTC')->startOfMinute();
$this->logFlightActions('flight_departing', UserFlight::where('departure_date', $time)->get()->toArray());
$this->logFlightActions('flight_arriving', UserFlight::where('arrival_date', $time)->get()->toArray());
$this->logFlightActions('flight_departing', UserFlight::where('departure_date', $time)->get());
$this->logFlightActions('flight_arriving', UserFlight::where('arrival_date', $time)->get());
}
/**
* @param string $type
* @param UserFlight[] $flights
* @param Collection<UserFlight> $flights
* @return void
*/
private function logFlightActions(string $type, array $flights): void
private function logFlightActions(string $type, Collection $flights): void
{
foreach ($flights as $flight) {
UserAction::create([
'user_id' => $flight->user_id,
'type' => $type,
'data' => $flight->snapshot($flight->id),
'data' => [
'flight' => $flight->snapshot($flight->id),
]
]);
}
}
@@ -44,7 +44,6 @@ class UpdateDepartedFlights extends Command
public function handle(): void
{
$now = now()->utc();
$oneHourAgo = $now->copy()->subHours(1);
$userFlights = UserFlight::where('arrival_date', '<=', $now->copy()->subHour()->toDateTimeString())
->where('auto_update', true)
@@ -13,7 +13,7 @@ class AdminToolsController extends Controller
->map(fn ($path) => pathinfo($path, PATHINFO_FILENAME))
->toArray();*/
$existingFiles = collect(glob('C:\\Users\\josh\\WebstormProjects\\Watermark-Remover\\images\\liveries_processed\\*'))
$existingFiles = collect(glob(public_path('img/liveries/generated/*')))
->map(fn ($path) => pathinfo($path, PATHINFO_FILENAME))
->toArray();
+2
View File
@@ -33,6 +33,8 @@ class UserAction extends Model
'flight_imported' => 'Flight Imported from FR24',
'flight_logged' => 'Flight Logged',
'flight_deleted' => 'Flight Deleted',
'flight_departing' => 'Flight Departed',
'flight_arriving' => 'Flight Landed',
default => 'Unknown Action'
}
);