add projet
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Api\Admin;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use App\Http\Requests\Admin\SaveAdminNotificationSubjectsRequest;
|
||||
use App\Http\Requests\Admin\SavePrintNotificationRecipientsRequest;
|
||||
use App\Http\Resources\Admin\AdminNotificationAlertsResource;
|
||||
use App\Http\Resources\Admin\PrintRecipientsResource;
|
||||
use App\Services\Admin\AdminNotificationService;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class AdminNotificationController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
private AdminNotificationService $service
|
||||
) {}
|
||||
|
||||
public function alerts(): AdminNotificationAlertsResource
|
||||
{
|
||||
return new AdminNotificationAlertsResource($this->service->alertsPayload());
|
||||
}
|
||||
|
||||
public function saveSubjects(SaveAdminNotificationSubjectsRequest $request): JsonResponse
|
||||
{
|
||||
$result = $this->service->saveSubjects($request->validated('subjects') ?? []);
|
||||
return response()->json($result, ($result['ok'] ?? false) ? 200 : 422);
|
||||
}
|
||||
|
||||
public function printRecipients(): PrintRecipientsResource
|
||||
{
|
||||
return new PrintRecipientsResource($this->service->printRecipientsPayload());
|
||||
}
|
||||
|
||||
public function savePrintRecipients(SavePrintNotificationRecipientsRequest $request): JsonResponse
|
||||
{
|
||||
$result = $this->service->savePrintRecipients($request->validated('notify') ?? []);
|
||||
return response()->json($result, ($result['ok'] ?? false) ? 200 : 422);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user