42 lines
830 B
PHP
42 lines
830 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Models\Commons;
|
||
|
|
|
||
|
|
use App\Traits\BelongsToTenant;
|
||
|
|
use App\Traits\ModelTrait;
|
||
|
|
use Illuminate\Database\Eloquent\Model;
|
||
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
||
|
|
|
||
|
|
class Classification extends Model
|
||
|
|
{
|
||
|
|
use SoftDeletes, ModelTrait, BelongsToTenant;
|
||
|
|
|
||
|
|
protected $fillable = [
|
||
|
|
'tenant_id',
|
||
|
|
'group',
|
||
|
|
'code',
|
||
|
|
'name',
|
||
|
|
'is_active',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $casts = [
|
||
|
|
'is_active' => 'boolean',
|
||
|
|
'created_at' => 'datetime',
|
||
|
|
'updated_at' => 'datetime',
|
||
|
|
'deleted_at' => 'datetime',
|
||
|
|
];
|
||
|
|
|
||
|
|
protected $hidden = ['deleted_at'];
|
||
|
|
|
||
|
|
// 스코프
|
||
|
|
public function scopeGroup($q, string $group)
|
||
|
|
{
|
||
|
|
return $q->where('group', $group);
|
||
|
|
}
|
||
|
|
|
||
|
|
public function scopeActive($q)
|
||
|
|
{
|
||
|
|
return $q->where('is_active', 1);
|
||
|
|
}
|
||
|
|
}
|