fix pargar mande
This commit is contained in:
@@ -4,6 +4,7 @@ namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class PargarSyncLog extends Model
|
||||
{
|
||||
@@ -22,8 +23,29 @@ class PargarSyncLog extends Model
|
||||
'pargar_ref',
|
||||
'res',
|
||||
'data',
|
||||
'confirmed_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'confirmed_at' => 'datetime',
|
||||
];
|
||||
|
||||
private static ?bool $hasConfirmedAtColumn = null;
|
||||
|
||||
/** سازگاری با نصبهایی که هنوز مایگریشن confirmed_at را اجرا نکردهاند */
|
||||
public static function hasConfirmedAtColumn(): bool
|
||||
{
|
||||
if (self::$hasConfirmedAtColumn === null) {
|
||||
try {
|
||||
self::$hasConfirmedAtColumn = Schema::hasColumn('pargar_sync_logs', 'confirmed_at');
|
||||
} catch (\Throwable) {
|
||||
self::$hasConfirmedAtColumn = false;
|
||||
}
|
||||
}
|
||||
|
||||
return self::$hasConfirmedAtColumn;
|
||||
}
|
||||
|
||||
public function customer(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Customer::class);
|
||||
|
||||
Reference in New Issue
Block a user