Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
TblIfexLastUpdate
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3namespace App\Models;
4
5use Illuminate\Database\Eloquent\Factories\HasFactory;
6use Illuminate\Database\Eloquent\Model;
7
8class TblIfexLastUpdate extends Model
9{
10    use HasFactory;
11
12    protected $table = 'tbl_ifex_last_update';
13
14    protected $primaryKey = 'id';
15
16    public $incrementing = false;
17
18    // The table has no `created_at` column, only `updated_at`. Without this
19    // the updateOrCreate() in IfexController::syncQuotations() fails with
20    // "Unknown column 'created_at'" whenever row 1 doesn't exist yet (fresh
21    // DB restore), so every ifex-quotations:sync run exits 1 and the
22    // checkpoint is never saved (Sentry PHP-LARAVEL-1K / PHP-LARAVEL-6S).
23    const CREATED_AT = null;
24
25    // `id` must be fillable: updateOrCreate(['id' => 1], ...) builds the new
26    // row through fill(), which drops non-fillable keys, so the INSERT got an
27    // auto-increment id instead of 1 and readLastCoveredDate() (id = 1) never
28    // saw the checkpoint.
29    protected $fillable = [
30        'id',
31        'last_date',
32        'updatingNow',
33        'updated_at',
34        'updated_by',
35    ];
36}