fix : 분류 API
This commit is contained in:
41
app/Models/Commons/Classification.php
Normal file
41
app/Models/Commons/Classification.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user