ifnex/04_Laravel/app/Models/ShipmentCommitmentForm.php
Kazem Alghasi 7a8ff49baa feat(api): implement shipment commitment forms and document downloads
Introduce a complete workflow for managing shipment-related documents
and mandatory commitment forms between the Laravel backend and
WordPress frontend.

- Laravel:
  - Add `ShipmentCommitmentForm` model and migration to track signed
    forms per shipment.
  - Implement `CommitmentFormController` to handle fetching available
    forms and uploading signed documents.
  - Add PDF download endpoints for AWB, labels, and invoices via
    `ShipmentPdfController`.
  - Extend `User` model with notification management methods.
  - Add `FinanceOverviewWidget` for Filament dashboard.

- WordPress:
  - Implement AJAX handlers in `user-bridge.php` for PDF downloads and
    commitment form management.
  - Update `shortcodes.php` to display document download grid and
    dynamic commitment form upload interface in order details.
  - Add styling for document buttons and form status indicators in
    `ifnex-orders.css`.
2026-09-09 13:08:22 +03:30

48 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class ShipmentCommitmentForm extends Model
{
protected $fillable = [
'shipment_id',
'commitment_form_id',
'uploaded_file_path',
'uploaded_file_type',
'uploaded_file_size',
'status',
'notes',
'uploaded_by',
'verified_by',
'verified_at',
];
protected $casts = [
'uploaded_file_size' => 'integer',
'verified_at' => 'datetime',
];
public function shipment(): BelongsTo
{
return $this->belongsTo(Shipment::class);
}
public function form(): BelongsTo
{
return $this->belongsTo(CommitmentForm::class, 'commitment_form_id');
}
public function uploader(): BelongsTo
{
return $this->belongsTo(User::class, 'uploaded_by');
}
public function verifier(): BelongsTo
{
return $this->belongsTo(User::class, 'verified_by');
}
}