36 lines
680 B
PHP
36 lines
680 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class Index extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'indexes';
|
|
|
|
protected $fillable = [
|
|
'table_id',
|
|
'index_name',
|
|
'columns',
|
|
'is_unique',
|
|
'is_primary',
|
|
'index_type',
|
|
'definition',
|
|
];
|
|
|
|
protected $casts = [
|
|
'columns' => 'array',
|
|
'is_unique' => 'boolean',
|
|
'is_primary' => 'boolean',
|
|
];
|
|
|
|
public function table(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Table::class);
|
|
}
|
|
}
|