first commit
This commit is contained in:
84
routes/api.php
Normal file
84
routes/api.php
Normal file
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\AuthController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use App\Http\Controllers\SetupController;
|
||||
use App\Http\Controllers\SettingController;
|
||||
use App\Http\Controllers\CategoryController;
|
||||
use App\Http\Controllers\MenuController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| 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::group(['prefix' => 'v1', 'middleware' => ['keyChecker', 'locale']], function () {
|
||||
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::get('/loggedIn', [AuthController::class, 'loggedInUser']);
|
||||
Route::post('/updateUser', [AuthController::class, 'updateUser']);
|
||||
Route::post('/deleteUser/{id}', [AuthController::class, 'destroy']);
|
||||
Route::post('/updatePassword', [AuthController::class, 'updatePassword']);
|
||||
Route::post('/updateFcmToken', [AuthController::class, 'updateFcmToken']);
|
||||
});
|
||||
|
||||
Route::post('/login', [AuthController::class, 'login']);
|
||||
Route::post('/register', [AuthController::class, 'register']);
|
||||
Route::get('/settings', [SettingController::class, 'index']);
|
||||
Route::get('/getAllData', [CategoryController::class, 'getAllData']);
|
||||
|
||||
Route::group(['prefix' => 'client',], function () {
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
// Persons who wants to get services
|
||||
});
|
||||
Route::get('menus', [MenuController::class, 'index']);
|
||||
// Category Routes
|
||||
Route::get('/categories', [CategoryController::class, 'index']);
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'waiter',], function () {
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
// Persons who wants to make money by providing services
|
||||
});
|
||||
});
|
||||
|
||||
Route::group(['prefix' => 'admin',], function () {
|
||||
Route::middleware('auth:sanctum')->group(function () {
|
||||
Route::group(['prefix' => 'setup',], function () {
|
||||
Route::get('/migrateFreshSeed', [SetupController::class, 'migrateFreshSeed']);
|
||||
Route::get('/migrateFresh', [SetupController::class, 'migrateFresh']);
|
||||
Route::get('/migrate', [SetupController::class, 'migrate']);
|
||||
Route::get('/seed', [SetupController::class, 'seed']);
|
||||
Route::get('/clearCache', [SetupController::class, 'clearCache']);
|
||||
});
|
||||
|
||||
// admins to keep track clients and service providers
|
||||
Route::get('/categories', [CategoryController::class, 'index']);
|
||||
Route::get('/categories/{id}', [CategoryController::class, 'show']);
|
||||
Route::post('/categories', [CategoryController::class, 'store']);
|
||||
Route::put('/categories/{id}', [CategoryController::class, 'update']);
|
||||
Route::delete('/categories/{id}', [CategoryController::class, 'destroy']);
|
||||
// Menu Routes
|
||||
Route::get('menus', [MenuController::class, 'index']);
|
||||
Route::post('menus', [MenuController::class, 'store']);
|
||||
Route::get('menus/{id}', [MenuController::class, 'show']);
|
||||
Route::post('menus/{id}', [MenuController::class, 'update']);
|
||||
Route::delete('menus/{id}', [MenuController::class, 'destroy']);
|
||||
// Get all categories with their items for admin
|
||||
Route::get('/getAllData', [CategoryController::class, 'getAllData']);
|
||||
// Import all data from bella_menu.json
|
||||
Route::post('/importAllData', [CategoryController::class, 'importAllData']);
|
||||
});
|
||||
|
||||
|
||||
Route::get('menusMcp/{id}', [MenuController::class, 'showMcp']);
|
||||
Route::post('menusMcp/{id}', [MenuController::class, 'updateMcp']);
|
||||
});
|
||||
});
|
||||
18
routes/channels.php
Normal file
18
routes/channels.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Broadcast;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Broadcast Channels
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here you may register all of the event broadcasting channels that your
|
||||
| application supports. The given channel authorization callbacks are
|
||||
| used to check if an authenticated user can listen to the channel.
|
||||
|
|
||||
*/
|
||||
|
||||
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
|
||||
return (int) $user->id === (int) $id;
|
||||
});
|
||||
19
routes/console.php
Normal file
19
routes/console.php
Normal file
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Console Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| This file is where you may define all of your Closure based console
|
||||
| commands. Each Closure is bound to a command instance allowing a
|
||||
| simple approach to interacting with each command's IO methods.
|
||||
|
|
||||
*/
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
39
routes/web.php
Normal file
39
routes/web.php
Normal file
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
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 view('welcome');
|
||||
});
|
||||
|
||||
// Route to serve images with CORS headers for Flutter web
|
||||
Route::get('images/{filename}', function ($filename) {
|
||||
$path = public_path('uploads/' . $filename);
|
||||
|
||||
if (!file_exists($path)) {
|
||||
abort(404);
|
||||
}
|
||||
|
||||
$file = file_get_contents($path);
|
||||
$type = mime_content_type($path);
|
||||
|
||||
return response($file, 200)
|
||||
->header('Content-Type', $type)
|
||||
->header('Access-Control-Allow-Origin', '*')
|
||||
->header('Access-Control-Allow-Methods', 'GET, HEAD, OPTIONS')
|
||||
->header('Access-Control-Allow-Headers', '*')
|
||||
->header('Access-Control-Expose-Headers', '*')
|
||||
->header('Access-Control-Max-Age', '86400')
|
||||
->header('Cache-Control', 'public, max-age=31536000');
|
||||
})->where('filename', '.*');
|
||||
Reference in New Issue
Block a user