fix : Trait 추가 및 query 디버깅 소스 수정
This commit is contained in:
24
app/Traits/ModelTrait.php
Normal file
24
app/Traits/ModelTrait.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use DateTimeInterface;
|
||||
|
||||
trait ModelTrait
|
||||
{
|
||||
/**
|
||||
* 날짜 직렬화 포맷 오버라이드 (모델에 추가해서 사용)
|
||||
*/
|
||||
protected function serializeDate(DateTimeInterface $date)
|
||||
{
|
||||
return $date->format('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
/**
|
||||
* Active 상태 조회
|
||||
*/
|
||||
public function scopeActive($query)
|
||||
{
|
||||
return $query->where('is_active', 1);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user