<?php
use App\Http\Controllers\Admin\NewsPodcastsController;
use App\Http\Controllers\Api\MessagesController;
use App\Http\Controllers\Api\RemindersController;
use App\Http\Controllers\Api\PushNotificationsController;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Response;
use Illuminate\Support\Facades\Route;
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider and all of them will
| be assigned to the "web" middleware group. Make something great!
|
*/
Route::get('/', function () {
return redirect()->route('admin.auth.login');
});
Route::get('image/{folder}/{image}', function ($folder, $image) {
try {
$path = storage_path('app/public/' . $folder . '/' . $image);
$file = File::get($path);
$type = File::mimeType($path);
if ($image == 'null') {
$path = asset('assets/img/logo.png');
$file = File::get($path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
} else {
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
}
} catch (Exception $e) {
$path = asset('assets/img/logo.png');
$file = File::get($path);
$type = File::mimeType($path);
$response = Response::make($file, 200);
$response->header("Content-Type", $type);
}
return $response;
})->name('image');
Route::post('set-reminder', [RemindersController::class, 'setReminder'])->name('set_reminder');
Route::post('delete-reminder', [RemindersController::class, 'deleteReminder'])->name('remove_reminder');
Route::get('news-podcast/{type}', [NewsPodcastsController::class, 'allApi'])->name('news_api');
Route::post('send-message', [MessagesController::class, 'sendMessage'])->name('messages_api');
Route::get('send-push', [PushNotificationsController::class, 'send'])->name('push');