ifnex/04_Laravel/app/Notifications/CommitmentFormVerifiedNotification.php
Kazem Alghasi 0209b6b32e feat(commitment-forms): implement end-to-end management and secure file access
Integrate a complete workflow for commitment forms including secure template downloads, customer uploads via WordPress AJAX, and administrative verification with automated notifications.

- Implement `downloadTemplate` and `downloadSigned` logic in `CommitmentFormController` to replace public symlinks with ownership-verified routes.
- Add `CommitmentFormVerifiedNotification` and `CommitmentFormRejectedNotification` to alert customers of status changes.
- Enhance WordPress bridge with AJAX-driven form listing, status badges, and upload capabilities.
- Update Filament `CommitmentFormsRelationManager` to provide better visibility into form directions and descriptions while restricting status edits to specific actions.
- Refactor Laravel 11 bootstrap configuration to handle guest redirection for API and web routes correctly.
- Add administrative controllers for secure file access within the admin panel.
2026-10-03 05:58:59 +03:30

42 lines
1.2 KiB
PHP

<?php
namespace App\Notifications;
use App\Models\ShipmentCommitmentForm;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
/**
* اعلان به مشتری: تعهدنامهٔ آپلودشدهٔ شما تأیید شد.
* (Trigger: CommitmentFormsRelationManager::verify)
*/
class CommitmentFormVerifiedNotification extends Notification
{
use Queueable;
public function __construct(
public ShipmentCommitmentForm $record,
) {}
public function via($notifiable): array
{
return ['database'];
}
public function toArray($notifiable): array
{
$this->record->loadMissing(['shipment', 'form']);
$awb = $this->record->shipment->awb_no;
$title = $this->record->form?->title ?? ('فرم #' . $this->record->commitment_form_id);
return [
'type' => 'commitment_verified',
'shipment_id' => $this->record->shipment_id,
'awb_no' => $awb,
'message' => "تعهدنامه «{$title}» سفارش {$awb} تأیید شد. ممنون از همکاری شما.",
'action_url' => '/order-detail/?order_id=' . $this->record->shipment_id,
];
}
}