'required|date|before_or_equal:today', 'content' => 'required|string', ]; } public function withValidator($validator) { $validator->after(function ($validator) { $reportDate = Carbon::parse($this->report_date)->startOfDay(); // Calculate standard deadline: 48 hours from the end of the report date $deadline = $reportDate->copy()->endOfDay()->addHours(48); if (now()->greaterThan($deadline)) { // Check if a valid override exists $hasOverride = ReportOverride::where('user_id', auth()->id()) ->where('report_date', $this->report_date) ->where('expires_at', '>', now()) ->exists(); if (!$hasOverride) { $validator->errors()->add( 'report_date', 'The 48-hour submission window for this date has expired. Please contact management for an override.' ); } } }); } }