Handle array-based filter states in CustomerCreditResource and ShipmentChecklistResource to ensure correct query execution. Also remove SoftDeletes trait from ShipmentChecklist model.
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class ShipmentChecklist extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'shipment_id',
|
|
'user_id',
|
|
'status',
|
|
'is_completed',
|
|
'notes',
|
|
'completed_at',
|
|
];
|
|
|
|
protected $casts = [
|
|
'is_completed' => 'boolean',
|
|
'completed_at' => 'datetime',
|
|
];
|
|
|
|
// ─── Relationships ───────────────────────────────
|
|
|
|
public function shipment()
|
|
{
|
|
return $this->belongsTo(Shipment::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
// ─── Helper Methods ──────────────────────────────
|
|
|
|
public function complete(): void
|
|
{
|
|
$this->update([
|
|
'is_completed' => true,
|
|
'completed_at' => now(),
|
|
]);
|
|
}
|
|
}
|