54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Admin\Sms;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Services\Admin\Sms\AdminSmsLogService;
|
|
use Illuminate\Http\Request;
|
|
|
|
final class AdminSmsLogController extends Controller
|
|
{
|
|
public function __construct(
|
|
private readonly AdminSmsLogService $service,
|
|
) {}
|
|
|
|
/**
|
|
* GET admin.sms.logs
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
$filters = $request->only([
|
|
'status', 'send_mode', 'q', 'date_from', 'date_to',
|
|
]);
|
|
|
|
$batches = $this->service->paginateBatches($filters, 30);
|
|
|
|
return view('admin.sms.logs.index', [
|
|
'batches' => $batches,
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* GET admin.sms.logs.show
|
|
*/
|
|
public function show(int $batchId, Request $request)
|
|
{
|
|
$batch = $this->service->getBatch($batchId);
|
|
if (!$batch) {
|
|
return redirect()->route('admin.sms.logs')->with('toast', [
|
|
'type' => 'danger',
|
|
'title' => '없음',
|
|
'message' => '해당 발송 이력을 찾을 수 없습니다.',
|
|
]);
|
|
}
|
|
|
|
$filters = $request->only(['status', 'to', 'q']);
|
|
$items = $this->service->paginateItems($batchId, $filters, 50);
|
|
|
|
return view('admin.sms.logs.show', [
|
|
'batch' => $batch,
|
|
'items' => $items,
|
|
]);
|
|
}
|
|
}
|