47 lines
1.6 KiB
PHP
47 lines
1.6 KiB
PHP
<?php
|
|
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
use App\Models\CountryLocale;
|
|
use App\Models\Category;
|
|
|
|
/*
|
|
|--------------------------------------------------------------------------
|
|
| API Routes
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
| Here is where you can register API routes for your application. These
|
|
| routes are loaded by the RouteServiceProvider and all of them will
|
|
| be assigned to the "api" middleware group. Make something great!
|
|
|
|
|
*/
|
|
|
|
Route::post('login', [App\Http\Controllers\Auth\LoginController::class, 'login'])->name('api.auth.login.post');
|
|
|
|
Route::middleware('auth:sanctum')->post('logout',[App\Http\Controllers\Auth\LoginController::class,'logout'])->name('api.auth.logout.post');
|
|
|
|
Route::prefix('admin')->middleware('auth:sanctum')->group(function () {
|
|
|
|
Route::get('/country-locales', function() {
|
|
$country_locales = CountryLocale::where('enabled', true)->get();
|
|
$default_locale_slug = 'my';
|
|
|
|
return response()->json(compact('country_locales','default_locale_slug'));
|
|
|
|
})->name('api.admin.country-locales');
|
|
|
|
Route::get('/categories/{country_locale_slug}', function($country_locale_slug) {
|
|
$categories = Category::where('enabled', true)->where('country_locale_slug', $country_locale_slug)->get();
|
|
|
|
return response()->json(compact('categories'));
|
|
|
|
})->name('api.admin.categories');
|
|
|
|
|
|
});
|
|
|
|
Route::post('admin/image/upload', [App\Http\Controllers\Services\ImageUploadController::class, 'index'])->name('api.admin.upload.cloud.image');
|
|
|
|
|