Add (new post)
This commit is contained in:
@@ -3,6 +3,9 @@
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
use App\Models\CountryLocale;
|
||||
use App\Models\Category;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
@@ -14,6 +17,30 @@
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
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');
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user