first commit
This commit is contained in:
29
Modules/Admin/app/Models/Dropdown.php
Normal file
29
Modules/Admin/app/Models/Dropdown.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Admin\Models;
|
||||
|
||||
use App\Traits\StatusTrait;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Str;
|
||||
|
||||
class Dropdown extends Model
|
||||
{
|
||||
use StatusTrait;
|
||||
protected $table = 'tbl_dropdowns';
|
||||
protected $fillable = ['fid', 'title', 'alias', 'status'];
|
||||
protected $appends = ['status_name'];
|
||||
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 field()
|
||||
{
|
||||
return $this->belongsTo(Field::class, 'fid');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user