오늘 이슈(TodayIssue) 기능 구현
- TodayIssue 모델 및 마이그레이션 추가 - TodayIssueController, TodayIssueService 구현 - TodayIssueObserverService 및 Observer 패턴 적용 - DailyReportService 연동 - Swagger API 문서 업데이트 - 라우트 추가
This commit is contained in:
38
app/Observers/TodayIssue/ClientIssueObserver.php
Normal file
38
app/Observers/TodayIssue/ClientIssueObserver.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Observers\TodayIssue;
|
||||
|
||||
use App\Models\Orders\Client;
|
||||
use App\Services\TodayIssueObserverService;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
/**
|
||||
* Client 모델의 TodayIssue Observer
|
||||
*/
|
||||
class ClientIssueObserver
|
||||
{
|
||||
public function __construct(
|
||||
protected TodayIssueObserverService $service
|
||||
) {}
|
||||
|
||||
public function created(Client $client): void
|
||||
{
|
||||
$this->safeExecute(fn () => $this->service->handleClientCreated($client));
|
||||
}
|
||||
|
||||
public function deleted(Client $client): void
|
||||
{
|
||||
$this->safeExecute(fn () => $this->service->handleClientDeleted($client));
|
||||
}
|
||||
|
||||
protected function safeExecute(callable $callback): void
|
||||
{
|
||||
try {
|
||||
$callback();
|
||||
} catch (\Throwable $e) {
|
||||
Log::warning('TodayIssue ClientObserver failed', [
|
||||
'error' => $e->getMessage(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user