Files
lelong/app/Models/JanaNotisExport.php
T

43 lines
891 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class JanaNotisExport extends Model
{
use HasFactory;
protected $table = 'jana_notis_exports';
protected $fillable = [
'user_id',
'lelong_id',
'kodcaw',
'fasa',
'status',
'file_path',
'file_name',
'error_message',
];
public const STATUS_PENDING = 'pending';
public const STATUS_PROCESSING = 'processing';
public const STATUS_COMPLETED = 'completed';
public const STATUS_FAILED = 'failed';
public function isReady()
{
return $this->status === self::STATUS_COMPLETED && ! empty($this->file_path);
}
public function isInProgress()
{
return in_array($this->status, [self::STATUS_PENDING, self::STATUS_PROCESSING], true);
}
}