first commit
This commit is contained in:
44
app/Models/SchemaChange.php
Normal file
44
app/Models/SchemaChange.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class SchemaChange extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
protected $fillable = [
|
||||
'table_id',
|
||||
'change_type',
|
||||
'old_value',
|
||||
'new_value',
|
||||
'description',
|
||||
'is_applied',
|
||||
'detected_at',
|
||||
];
|
||||
|
||||
protected $casts = [
|
||||
'old_value' => 'array',
|
||||
'new_value' => 'array',
|
||||
'is_applied' => 'boolean',
|
||||
'detected_at' => 'datetime',
|
||||
];
|
||||
|
||||
public function table(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Table::class);
|
||||
}
|
||||
|
||||
public function scopePending($query)
|
||||
{
|
||||
return $query->where('is_applied', false);
|
||||
}
|
||||
|
||||
public function scopeApplied($query)
|
||||
{
|
||||
return $query->where('is_applied', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user