49 lines
1.1 KiB
PHP
49 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Package extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $fillable = [
|
|
'uuid', 'type', 'status', 'name', 'description', 'meta',
|
|
'total_items', 'processing_count', 'sent_count', 'failed_count',
|
|
'created_by', 'finished_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'meta' => 'array',
|
|
'finished_at' => 'datetime',
|
|
'total_items' => 'integer',
|
|
'processing_count' => 'integer',
|
|
'sent_count' => 'integer',
|
|
'failed_count' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function items()
|
|
{
|
|
return $this->hasMany(PackageItem::class);
|
|
}
|
|
|
|
public const TYPE_SMS = 'sms';
|
|
|
|
public const STATUS_DRAFT = 'draft';
|
|
|
|
public const STATUS_QUEUED = 'queued';
|
|
|
|
public const STATUS_RUNNING = 'running';
|
|
|
|
public const STATUS_COMPLETED = 'completed';
|
|
|
|
public const STATUS_FAILED = 'failed';
|
|
|
|
public const STATUS_CANCELED = 'canceled';
|
|
}
|