first commit
This commit is contained in:
66
laravel/app/Models/SyncState.php
Normal file
66
laravel/app/Models/SyncState.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\SyncStatus;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $entity
|
||||
* @property \Illuminate\Support\Carbon|null $started_at
|
||||
* @property \Illuminate\Support\Carbon $date_from
|
||||
* @property \Illuminate\Support\Carbon|null $date_to
|
||||
* @property SyncStatus $status
|
||||
* @property string|null $batch_id
|
||||
* @property int|null $total_pages
|
||||
* @property int $processed_pages
|
||||
* @property \Illuminate\Support\Carbon|null $created_at
|
||||
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState newModelQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState newQuery()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState query()
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereBatchId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereCreatedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereDateFrom($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereDateTo($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereEntity($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereId($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereProcessedPages($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereStartedAt($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereStatus($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereTotalPages($value)
|
||||
* @method static \Illuminate\Database\Eloquent\Builder<static>|SyncState whereUpdatedAt($value)
|
||||
* @mixin \Eloquent
|
||||
*/
|
||||
class SyncState extends Model
|
||||
{
|
||||
protected $table = 'sync_states';
|
||||
protected $fillable = [
|
||||
'entity',
|
||||
'date_from',
|
||||
'date_to',
|
||||
'status',
|
||||
'batch_id',
|
||||
'total_pages',
|
||||
'processed_pages',
|
||||
'started_at',
|
||||
];
|
||||
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'date_from' => 'date',
|
||||
'date_to' => 'date',
|
||||
'started_at' => 'datetime',
|
||||
'status' => SyncStatus::class,
|
||||
'total_pages' => 'integer',
|
||||
'processed_pages' => 'integer',
|
||||
];
|
||||
}
|
||||
|
||||
public function incrementProcessedPages(): void
|
||||
{
|
||||
$this->increment('processed_pages');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user