37 lines
676 B
PHP
37 lines
676 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models;
|
||
|
|
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||
|
|
|
||
|
|
class NotificationSettingGroupItem extends Model
|
||
|
|
{
|
||
|
|
protected $fillable = [
|
||
|
|
'group_id',
|
||
|
|
'notification_type',
|
||
|
|
'label',
|
||
|
|
'sort_order',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'sort_order' => 'integer',
|
||
|
|
];
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 그룹 관계
|
||
|
|
*/
|
||
|
|
public function group(): BelongsTo
|
||
|
|
{
|
||
|
|
return $this->belongsTo(NotificationSettingGroup::class, 'group_id');
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Scope: 정렬순
|
||
|
|
*/
|
||
|
|
public function scopeOrdered($query)
|
||
|
|
{
|
||
|
|
return $query->orderBy('sort_order');
|
||
|
|
}
|
||
|
|
}
|