<?php
use App\Http\Controllers\Admin\Auth\LoginController;
use App\Http\Controllers\Admin\DashboardController;
use App\Http\Controllers\Admin\FaceBookLinkController;
use App\Http\Controllers\Admin\NewsPodcastsController;
use App\Http\Controllers\Admin\ScheduleController;
use App\Http\Controllers\Admin\UploadImagesController;
use App\Http\Controllers\Admin\UsersController;
use App\Http\Controllers\Api\MessagesController;
use Illuminate\Support\Facades\Route;
Route::as('admin.')->group(function () {
Route::controller(LoginController::class)->prefix('auth')->as('auth.')->group(function () {
Route::get('login', 'index')->name('login');
Route::post('login', 'submit');
Route::get('logout', 'logout')->name('logout');
});
Route::middleware(['admin'])->group(function () {
Route::get('/', [DashboardController::class, 'index'])->name('dashboard');
Route::prefix('schedule')->as('schedule.')->group(function () {
Route::get('/', [ScheduleController::class, 'index'])->name('all');
Route::get('add', [ScheduleController::class, 'add'])->name('add');
Route::post('add', [ScheduleController::class, 'store'])->name('add');
Route::get('edit/{key}', [ScheduleController::class, 'edit'])->name('edit');
Route::post('update/{key}', [ScheduleController::class, 'update'])->name('update');
Route::get('delete/{key}', [ScheduleController::class, 'remove'])->name('delete');
});
Route::prefix('news-podcasts')->as('news_podcasts.')->group(function () {
Route::get('/', [NewsPodcastsController::class, 'index'])->name('all');
Route::get('news-podcasts', [NewsPodcastsController::class, 'listApi'])->name('listApi');
Route::get('add', [NewsPodcastsController::class, 'add'])->name('add');
Route::post('store', [NewsPodcastsController::class, 'store'])->name('store');
Route::get('edit-news-podcasts/{id}', [NewsPodcastsController::class, 'edit'])->name('edit');
Route::post('update-news-podcasts/{id}', [NewsPodcastsController::class, 'update'])->name('update');
Route::get('delete-news-podcasts/{id}', [NewsPodcastsController::class, 'delete'])->name('delete');
});
Route::prefix('facebook-link')->as('facebook_link.')->group(function () {
Route::get('/', [FaceBookLinkController::class, 'index'])->name('all');
Route::get('add', [FaceBookLinkController::class, 'add'])->name('add');
Route::post('store', [FaceBookLinkController::class, 'store'])->name('store');
Route::get('delete/{key}', [FaceBookLinkController::class, 'remove'])->whereIn('key', [0])->name('delete');
});
Route::prefix('images')->as('images.')->group(function () {
Route::get('/', [UploadImagesController::class, 'index'])->name('all');
Route::get('add', [UploadImagesController::class, 'add'])->name('add');
Route::post('store', [UploadImagesController::class, 'store'])->name('store');
Route::get('list-images', [UploadImagesController::class, 'listApi'])->name('list-images');
Route::get('delete-image/{folder_name}/{file_name}', [UploadImagesController::class, 'delete'])->name('delete');
});
Route::prefix('messages')->as('messages.')->group(function () {
Route::get('/', [MessagesController::class, 'index'])->name('all');
});
Route::prefix('users')->as('users.')->group(function () {
Route::get('/', [UsersController::class, 'index'])->name('all');
Route::get('listApi', [UsersController::class, 'listApi'])->name('listApi');
Route::get('add-user', [UsersController::class, 'add'])->name('add');
Route::post('add-user', [UsersController::class, 'store'])->name('store');
Route::get('edit-user/{id}', [UsersController::class, 'edit'])->name('edit');
Route::post('update-user/{id}', [UsersController::class, 'update'])->name('update');
Route::get('delete-user/{id}', [UsersController::class, 'delete'])->name('delete');
Route::post('change-password', [UsersController::class, 'changePassword'])->name('change_password');
Route::get('change-password', [UsersController::class, 'changepass'])->name('change_password');
});
});
});