ldc-crm/routes/api.php
2026-06-04 15:34:29 +02:00

145 lines
6.6 KiB
PHP

<?php
use App\Http\Controllers\Api\V2\AnswerController as V2AnswerController;
use App\Http\Controllers\Api\V2\ApiController as V2ApiController;
use App\Http\Controllers\Api\V2\ArcadiaController as V2ArcadiaController;
use App\Http\Controllers\Api\V2\CustomerController as V2CustomerController;
use App\Http\Controllers\Api\V2\OptinController as V2OptinController;
use App\Http\Controllers\Api\V2\QuestionController as V2QuestionController;
use App\Http\Controllers\Api\V2\StatsController as V2StatsController;
use App\Http\Controllers\Api\V4\AnswerController as V4AnswerController;
use App\Http\Controllers\Api\V4\ApiController as V4ApiController;
use App\Http\Controllers\Api\V4\ArcadiaController as V4ArcadiaController;
use App\Http\Controllers\Api\V4\ClaimController as V4ClaimController;
use App\Http\Controllers\Api\V4\CustomerController as V4CustomerController;
use App\Http\Controllers\Api\V4\OptinController as V4OptinController;
use App\Http\Controllers\Api\V4\QuestionController as V4QuestionController;
use App\Http\Controllers\Api\V4\StatsController as V4StatsController;
use App\Http\Controllers\Api\WebhookController;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
Route::prefix('v2')->name('apiV2.')->group(function () {
// * PUBLIC
Route::get('/ping', [V2ApiController::class, 'ping'])->name('ping');
// * PRIVATE
Route::middleware('auth:api')->group(function () {
// * OPTINS
Route::post('/optin', [V2OptinController::class, 'optin'])->name('optin');
Route::post('/optout', [V2OptinController::class, 'optoutWithHashcode'])->name('optout-hashcode');
// * CUSTOMERS
Route::apiResource('customers', V2CustomerController::class, [
'except' => 'index',
'parameters' => ['customers' => 'serviceCustomer']
]);
Route::prefix('customers')->name('customers.')->group(function () {
Route::post('/authenticate', [V2CustomerController::class, 'authenticate'])->name('authenticate');
Route::prefix('{serviceCustomer}')->group(function () {
Route::post('/activate', [V2CustomerController::class, 'activateAccount'])->name('activate');
Route::post('/answers', [V2AnswerController::class, 'storeCustomerAnswers'])
->name('answers.store');
});
});
// * ARCADIA
Route::prefix('arcadia')->name('arcadia.')->group(function () {
Route::post('/outgoing-mail/default', [V2ArcadiaController::class, 'outgoingMailDefault'])
->name('outgoingMailDefault');
Route::post('/outgoing-mail/game', [V2ArcadiaController::class, 'outgoingMailGame'])
->name('outgoingMailGame');
});
// * QUESTIONS
Route::apiResource('questions', V2QuestionController::class, [
'parameters' => ['questions' => 'serviceQuestion']
])->only('index');
Route::prefix('questions')->name('questions.')->group(function () {
Route::get('/un-answered-by/{serviceCustomer}', [V2QuestionController::class, 'unAnsweredBy'])
->name('unAnsweredBy');
Route::get('/with-answers/{serviceCustomer}', [V2QuestionController::class, 'indexWithResponse'])
->name('indexWithResponse');
});
// * STATS
Route::prefix('stats')->name('stats.')->group(function () {
Route::get('/brand', [V2StatsController::class, 'brandStats'])
->name('brandStats');
Route::get('/question/{serviceQuestion}', [V2StatsController::class, 'questionStats'])
->name('questionStats');
});
});
});
Route::prefix('v4')->name('apiV4.')->group(function () {
// * PUBLIC
Route::get('/ping', [V4ApiController::class, 'ping'])->name('ping');
// * PRIVATE
Route::middleware('auth:api')->group(function () {
// * OPTINS
Route::post('/optin', [V4OptinController::class, 'optin'])->name('optin');
Route::post('/optout', [V4OptinController::class, 'optoutWithHashcode'])->name('optout-hashcode');
// * CUSTOMERS
Route::apiResource('customers', V4CustomerController::class, [
'except' => 'index',
'parameters' => ['customers' => 'serviceCustomer']
]);
Route::prefix('customers')->name('customers.')->group(function () {
Route::post('/authenticate', [V4CustomerController::class, 'authenticate'])->name('authenticate');
Route::prefix('{serviceCustomer}')->group(function () {
Route::post('/activate', [V4CustomerController::class, 'activateAccount'])->name('activate');
Route::post('/answers', [V4AnswerController::class, 'storeCustomerAnswers'])
->name('answers.store');
});
});
// * ARCADIA
Route::prefix('arcadia')->name('arcadia.')->group(function () {
Route::post('/outgoing-mail/default', [V4ArcadiaController::class, 'outgoingMailDefault'])
->name('outgoingMailDefault');
Route::post('/outgoing-mail/game', [V4ArcadiaController::class, 'outgoingMailGame'])
->name('outgoingMailGame');
});
// * QUESTIONS
Route::apiResource('questions', V4QuestionController::class, [
'parameters' => ['questions' => 'serviceQuestion']
])->only('index');
Route::prefix('questions')->name('questions.')->group(function () {
Route::get('/un-answered-by/{serviceCustomer}', [V4QuestionController::class, 'unAnsweredBy'])
->name('unAnsweredBy');
Route::get('/with-answers/{serviceCustomer}', [V4QuestionController::class, 'indexWithResponse'])
->name('indexWithResponse');
});
// * STATS
Route::prefix('stats')->name('stats.')->group(function () {
Route::get('/brand', [V4StatsController::class, 'brandStats'])
->name('brandStats');
Route::get('/question/{serviceQuestion}', [V4StatsController::class, 'questionStats'])
->name('questionStats');
});
// * CLAIMS
Route::post('/claim', [V4ClaimController::class, 'store'])->name('claim.store');
});
});
Route::post('/webhook/mailjet', [WebhookController::class, 'handleMailjetWebhook'])->name('webhook.mailjet');