30 lines
588 B
PHP
30 lines
588 B
PHP
|
<?php
|
||
|
|
||
|
namespace Modules\Admin\Models;
|
||
|
|
||
|
use Illuminate\Database\Eloquent\Model;
|
||
|
use Str;
|
||
|
|
||
|
class Field extends Model
|
||
|
{
|
||
|
protected $table = 'tbl_fields';
|
||
|
protected $fillable = ['title', 'alias', 'status'];
|
||
|
|
||
|
protected static function booted()
|
||
|
{
|
||
|
|
||
|
static::creating(function ($field) {
|
||
|
$field->alias = Str::slug($field->title);
|
||
|
});
|
||
|
|
||
|
static::updating(function ($field) {
|
||
|
$field->alias = Str::slug($field->title);
|
||
|
});
|
||
|
}
|
||
|
|
||
|
public function dropdown()
|
||
|
{
|
||
|
return $this->hasMany(Dropdown::class, 'fid');
|
||
|
}
|
||
|
}
|