ldc-crm/routes/api.php
2023-10-06 16:33:21 +02:00

76 lines
3.4 KiB
PHP

<?php
use Illuminate\Support\Facades\Route;
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\AnswerController as V2AnswerController;
use App\Http\Controllers\Api\V2\QuestionController as V2QuestionController;
use App\Http\Controllers\Api\V2\StatsController as V2StatsController;
/*
|--------------------------------------------------------------------------
| 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');
});
});
});