D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
forge
/
re-viewers.com
/
routes
/
Filename :
api.php
back
Copy
<?php use App\Http\Controllers\Api\{AuthController, FrontendApiController, GoogleApiAuthController}; use Illuminate\Support\Facades\Route; Route::prefix('v1')->group(function () { // 🏠 Main Route::get('index', [FrontendApiController::class, 'index']); // 🔓 Public Endpoints Route::get('sliders', [FrontendApiController::class, 'sliders']); Route::get('categories', [FrontendApiController::class, 'categories']); Route::get('brands', [FrontendApiController::class, 'brands']); Route::get('brand/{id}/products', [FrontendApiController::class, 'brandProducts']); Route::get('products', [FrontendApiController::class, 'products']); Route::get('category/{id}', [FrontendApiController::class, 'category']); Route::get('product/{id}', [FrontendApiController::class, 'product']); Route::get('products/category/{id}', [FrontendApiController::class, 'productsByCategory']); // ✅ متأكد إنها موجودة // Static Pages Route::get('about', [FrontendApiController::class, 'about']); Route::get('faq', [FrontendApiController::class, 'faq']); Route::get('terms', [FrontendApiController::class, 'terms']); Route::get('privacy', [FrontendApiController::class, 'privacy']); // Contact Route::get('contact/subjects', [FrontendApiController::class, 'contactSubjects']); Route::post('contact', [FrontendApiController::class, 'sendContact']); // Products sorting Route::get('products/latest', [FrontendApiController::class, 'latestProducts']); Route::get('products/top-rated', [FrontendApiController::class, 'topRatedProducts']); Route::get('products/most-viewed', [FrontendApiController::class, 'mostViewedProducts']); // Auth Route::post('register', [FrontendApiController::class, 'register']); Route::post('login', [AuthController::class, 'login']); // Google Auth Route::get('auth/google/url', [GoogleApiAuthController::class, 'getAuthUrl']); Route::get('auth/google/callback', [GoogleApiAuthController::class, 'callback']); // 🔐 Protected (Sanctum) Route::middleware('auth:sanctum')->group(function () { Route::get('user', [FrontendApiController::class, 'show']); Route::post('user/update', [FrontendApiController::class, 'update']); Route::post('product/{id}/comment', [FrontendApiController::class, 'storeComment']); Route::post('product/{id}/rate', [FrontendApiController::class, 'rate']); Route::post('logout', [AuthController::class, 'logout']); Route::post('comment/{id}/update', [FrontendApiController::class, 'updateComment']); Route::delete('comment/{id}/delete', [FrontendApiController::class, 'deleteComment']); }); });