intial commit
This commit is contained in:
+145
@@ -0,0 +1,145 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Api\Auth\RegisterUserController;
|
||||
use App\Http\Controllers\Api\AnakController;
|
||||
use App\Http\Controllers\Api\CommentController;
|
||||
use App\Http\Controllers\Api\DesaController;
|
||||
use App\Http\Controllers\Api\OrangTuaController;
|
||||
use App\Http\Controllers\Api\PostController;
|
||||
use App\Http\Controllers\Api\PosyanduController;
|
||||
use App\Http\Controllers\Api\StatistikAnakController;
|
||||
use App\Http\Controllers\Api\UploadController;
|
||||
use App\Http\Controllers\Api\AiController;
|
||||
use App\Http\Controllers\Api\ArtikelController;
|
||||
use App\Http\Controllers\Api\ReminderController;
|
||||
use App\Http\Controllers\Api\KategoriController;
|
||||
use App\Http\Controllers\Api\Auth\AuthenticateUserController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
// Authenticated user endpoint
|
||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
|
||||
// Test endpoint
|
||||
Route::middleware('auth:sanctum')->get('test', function () {
|
||||
$user = Auth::user();
|
||||
return response()->json($user, 200);
|
||||
});
|
||||
|
||||
// Profile endpoints
|
||||
Route::middleware('auth:sanctum')->get('profile', [AuthenticateUserController::class, 'getProfile'])->name('profile.get');
|
||||
Route::middleware('auth:sanctum')->put('profile', [AuthenticateUserController::class, 'updateProfile'])->name('profile.update');
|
||||
|
||||
// User update endpoint
|
||||
Route::middleware('auth:sanctum')->put('auth/users/{id}', [RegisterUserController::class, 'updateUser'])->name('user.update');
|
||||
Route::middleware('auth:sanctum')->delete('auth/users/{id}', [RegisterUserController::class, 'deleteUser'])->name('user.delete');
|
||||
// Upload image endpoints
|
||||
Route::middleware('auth:sanctum')->post('upload-image', [UploadController::class, 'store']);
|
||||
Route::middleware('auth:sanctum')->get('image/{fileName}', [UploadController::class, 'index']);
|
||||
|
||||
// Desa endpoints
|
||||
Route::get('desa', [DesaController::class, 'index']);
|
||||
Route::post('desa', [DesaController::class, 'store']);
|
||||
Route::delete('desa/{id}', [DesaController::class, 'destroy']);
|
||||
|
||||
// Posyandu endpoints
|
||||
Route::get('posyandu', [PosyanduController::class, 'index']);
|
||||
Route::post('posyandu', [PosyanduController::class, 'store']);
|
||||
Route::delete('posyandu/{id}', [PosyanduController::class, 'destroy']);
|
||||
|
||||
// Comment endpoints
|
||||
Route::get('comment', [CommentController::class, 'index']);
|
||||
Route::post('comment', [CommentController::class, 'store']);
|
||||
Route::get('comment/{id}', [CommentController::class, 'show']);
|
||||
Route::delete('comment/{id}', [CommentController::class, 'destroy']);
|
||||
|
||||
// Post endpoints
|
||||
Route::post('post', [PostController::class, 'store']);
|
||||
Route::get('post', [PostController::class, 'index']);
|
||||
Route::get('ganti', [PostController::class, 'changeobesitas']);
|
||||
Route::get('gantiLK', [PostController::class, 'changestatusLK']);
|
||||
Route::get('post/orang-tua/{id}', [PostController::class, 'showByOrangTua']);
|
||||
Route::get('post/tenaga-kesehatan/{id}', [PostController::class, 'showByTenagaKesehatan']);
|
||||
Route::get('post/{id}', [PostController::class, 'show']);
|
||||
Route::put('post/{id}', [PostController::class, 'update']);
|
||||
Route::delete('post/{id}', [PostController::class, 'destroy']);
|
||||
|
||||
// Export and statistics endpoints
|
||||
Route::get('export-data-anak-csv', [AnakController::class, 'exportDataAnakCSV']);
|
||||
Route::get('approve-all-anak', [AnakController::class, 'approveAllAnak']);
|
||||
Route::get('statistik-gizi/{id}', [DesaController::class, 'getStatistikDesa']);
|
||||
|
||||
// Artikel endpoints
|
||||
Route::middleware('auth:sanctum')->get('cari-artikel', [AiController::class, 'searchArticle']);
|
||||
Route::middleware('auth:sanctum')->get('artikel', [ArtikelController::class, 'index']);
|
||||
Route::middleware('auth:sanctum')->post('artikel', [ArtikelController::class, 'store']);
|
||||
Route::get('artikel/{id}', [ArtikelController::class, 'show']);
|
||||
Route::middleware('auth:sanctum')->post('artikel/{id}', [ArtikelController::class, 'update']);
|
||||
Route::middleware('auth:sanctum')->delete('artikel/{id}', [ArtikelController::class, 'destroy']);
|
||||
Route::middleware('auth:sanctum')->get('artikel/{id}/image', [ArtikelController::class, 'getImage']);
|
||||
|
||||
// Reminder endpoints
|
||||
Route::middleware('auth:sanctum')->get('reminderall', [ReminderController::class, 'index']);
|
||||
Route::middleware('auth:sanctum')->post('reminder', [ReminderController::class, 'store']);
|
||||
Route::middleware('auth:sanctum')->get('reminder', [ReminderController::class, 'show']);
|
||||
Route::middleware('auth:sanctum')->delete('reminder/{id}', [ReminderController::class, 'destroy']);
|
||||
Route::middleware('auth:sanctum')->put('reminder/{id}', [ReminderController::class, 'update']);
|
||||
|
||||
// Kategori endpoints
|
||||
Route::get('kategori', [KategoriController::class, 'index']);
|
||||
Route::post('kategori', [KategoriController::class, 'store']);
|
||||
Route::put('kategori/{id}', [KategoriController::class, 'update']);
|
||||
Route::delete('kategori/{id}', [KategoriController::class, 'destroy']);
|
||||
|
||||
// Orang Tua group
|
||||
Route::prefix("orang-tua")->middleware('auth:sanctum')->group(function () {
|
||||
Route::get('data-anak/{id}', [AnakController::class, 'show']);
|
||||
Route::post('data-anak', [AnakController::class, 'storeWithOrangTua']);
|
||||
Route::get('data-anak', [AnakController::class, 'indexWithOrangTua']);
|
||||
Route::put('data-anak/{id}', [AnakController::class, 'update']);
|
||||
|
||||
Route::post('statistik-anak', [StatistikAnakController::class, 'store']);
|
||||
Route::get('statistik-anak-all', [StatistikAnakController::class, 'ShowAllByOrtu']);
|
||||
Route::get('statistik-anak/{statistikAnak}', [StatistikAnakController::class, 'show']);
|
||||
Route::put('statistik-anak/{id}', [StatistikAnakController::class, 'update']);
|
||||
});
|
||||
|
||||
// Posyandu group
|
||||
Route::prefix("posyandu")->middleware('auth:sanctum')->group(function () {
|
||||
Route::get('orang-tua', [OrangTuaController::class, 'index']);
|
||||
Route::get('orang-tua/list', [AnakController::class, 'showOrangTua']);
|
||||
Route::post('orang-tua/{id}/approve', [AnakController::class, 'approveOrangTua']);
|
||||
Route::post('data-anak', [AnakController::class, 'storeWithKaderPosyandu']);
|
||||
Route::post('data-anak-excel', [AnakController::class, 'storeWithKaderPosyanduExcel']);
|
||||
Route::get('data-anak', [AnakController::class, 'indexWithKaderPosyandu']);
|
||||
Route::get('data-anak/export-data-anak-csv', [AnakController::class, 'exportDataAnakCSV2']); // Rute baru untuk ekspor Excel
|
||||
Route::get('data-anak/{id}', [AnakController::class, 'show']);
|
||||
Route::put('data-anak/{id}', [AnakController::class, 'update']);
|
||||
Route::get('data-anak/belum-approve', [AnakController::class, 'getAnakBelumDisetujui']);
|
||||
Route::delete('data-anak/{id}', [AnakController::class, 'destroy']);
|
||||
Route::get('kader-posyandu', [PosyanduController::class, 'showKaderPosyandu']);
|
||||
Route::get('tenaga-kesehatan', [PosyanduController::class, 'showTenagaKesehatan']);
|
||||
Route::delete('kader-posyandu/{userId}', [PosyanduController::class, 'deleteKaderPosyandu']);
|
||||
Route::delete('tenaga-kesehatan/{userId}', [PosyanduController::class, 'deleteTenagaKesehatan']);
|
||||
Route::post('statistik-anak', [StatistikAnakController::class, 'store']);
|
||||
Route::get('statistik-anak-all', [StatistikAnakController::class, 'ShowAllByOrtu']);
|
||||
Route::get('statistik-anak/{statistikAnak}', [StatistikAnakController::class, 'show']);
|
||||
Route::put('statistik-anak/{id}', [StatistikAnakController::class, 'update']);
|
||||
Route::delete('statistik-anak/{id}', [StatistikAnakController::class, 'destroy']);
|
||||
Route::get('belum-approve', [AnakController::class, 'getAnakBelumDisetujui']);
|
||||
Route::put('belum-approve/{id}/approve', [AnakController::class, 'approveAnak']);
|
||||
});
|
||||
@@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Auth\AuthenticatedSessionController;
|
||||
use App\Http\Controllers\Auth\ConfirmablePasswordController;
|
||||
use App\Http\Controllers\Auth\EmailVerificationNotificationController;
|
||||
use App\Http\Controllers\Auth\EmailVerificationPromptController;
|
||||
use App\Http\Controllers\Auth\NewPasswordController;
|
||||
use App\Http\Controllers\Auth\PasswordResetLinkController;
|
||||
use App\Http\Controllers\Auth\RegisteredUserController;
|
||||
use App\Http\Controllers\Auth\VerifyEmailController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
use App\Models\Desa;
|
||||
use App\Models\Posyandu;
|
||||
|
||||
Route::middleware('guest')->group(function () {
|
||||
Route::get('register', [RegisteredUserController::class, 'create'])
|
||||
->name('register');
|
||||
|
||||
Route::post('register', [RegisteredUserController::class, 'store']);
|
||||
|
||||
Route::get('register-orang-tua', function() {
|
||||
$data = [
|
||||
'desa' => Desa::all(),
|
||||
'posyandu' => Posyandu::all(),
|
||||
];
|
||||
return view('auth.register-orang-tua', $data);
|
||||
})->name('register-orang-tua');
|
||||
Route::post('register-orang-tua', [RegisteredUserController::class, 'storeOrangTua'])->name('register-orang-tua');
|
||||
|
||||
Route::get('register-posyandu', function() {
|
||||
$data = [
|
||||
'desa' => Desa::all(),
|
||||
'posyandu' => Posyandu::all(),
|
||||
];
|
||||
return view('auth.register-posyandu', $data);
|
||||
})->name('register-posyandu');
|
||||
Route::post('register-posyandu', [RegisteredUserController::class, 'storePosyandu'])->name('register-posyandu');
|
||||
|
||||
Route::get('login', [AuthenticatedSessionController::class, 'create'])
|
||||
->name('login');
|
||||
|
||||
Route::post('login', [AuthenticatedSessionController::class, 'store']);
|
||||
|
||||
Route::get('forgot-password', [PasswordResetLinkController::class, 'create'])
|
||||
->name('password.request');
|
||||
|
||||
Route::post('forgot-password', [PasswordResetLinkController::class, 'store'])
|
||||
->name('password.email');
|
||||
|
||||
Route::get('reset-password/{token}', [NewPasswordController::class, 'create'])
|
||||
->name('password.reset');
|
||||
|
||||
Route::post('reset-password', [NewPasswordController::class, 'store'])
|
||||
->name('password.update');
|
||||
});
|
||||
|
||||
Route::middleware('auth')->group(function () {
|
||||
Route::get('verify-email', [EmailVerificationPromptController::class, '__invoke'])
|
||||
->name('verification.notice');
|
||||
|
||||
Route::get('verify-email/{id}/{hash}', [VerifyEmailController::class, '__invoke'])
|
||||
->middleware(['signed', 'throttle:6,1'])
|
||||
->name('verification.verify');
|
||||
|
||||
Route::post('email/verification-notification', [EmailVerificationNotificationController::class, 'store'])
|
||||
->middleware('throttle:6,1')
|
||||
->name('verification.send');
|
||||
|
||||
Route::get('confirm-password', [ConfirmablePasswordController::class, 'show'])
|
||||
->name('password.confirm');
|
||||
|
||||
Route::post('confirm-password', [ConfirmablePasswordController::class, 'store']);
|
||||
|
||||
Route::post('logout', [AuthenticatedSessionController::class, 'destroy'])
|
||||
->name('logout');
|
||||
});
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\Api\Auth\RegisterUserController;
|
||||
use App\Http\Controllers\Api\Auth\AuthenticateUserController;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('testing', function () {
|
||||
$resp = [
|
||||
"code" => 200,
|
||||
"message" => "ok",
|
||||
];
|
||||
|
||||
return response()->json($resp, 200);
|
||||
});
|
||||
|
||||
Route::prefix("orang-tua")->group(function () {
|
||||
Route::post('register', [RegisterUserController::class, 'registerOrangTua']);
|
||||
Route::post('login', [AuthenticateUserController::class, 'loginOrangTua']);
|
||||
});
|
||||
|
||||
Route::prefix("posyandu")->group(function () {
|
||||
Route::post('register', [RegisterUserController::class, 'registerKaderPosyandu']);
|
||||
Route::post('login', [AuthenticateUserController::class, 'loginKaderPosyandu']);
|
||||
});
|
||||
|
||||
Route::prefix("desa")->group(function () {
|
||||
Route::post('register', [RegisterUserController::class, 'registerDesa']);
|
||||
Route::post('login', [AuthenticateUserController::class, 'loginDesa']);
|
||||
});
|
||||
|
||||
Route::prefix("tenaga-kesehatan")->group(function () {
|
||||
Route::post('register', [RegisterUserController::class, 'registerTenagaKesehatan']);
|
||||
Route::post('login', [AuthenticateUserController::class, 'loginTenagaKesehatan']);
|
||||
});
|
||||
|
||||
Route::prefix("admin")->group(function () {
|
||||
Route::post('register', [RegisterUserController::class, 'registerAdmin']);
|
||||
Route::post('login', [AuthenticateUserController::class, 'loginAdmin']);
|
||||
});
|
||||
|
||||
Route::post('login', [AuthenticateUserController::class, 'loginbaru']);
|
||||
|
||||
Route::middleware('auth:sanctum')->get('/user', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
@@ -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;
|
||||
});
|
||||
@@ -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');
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\DataAnakController;
|
||||
use App\Http\Controllers\AnakController;
|
||||
use App\Http\Controllers\StatistikAnakController;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
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 within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::get('/', function () {
|
||||
return view('welcome');
|
||||
});
|
||||
|
||||
Route::get('/dashboard', [DataAnakController::class, 'show'])->middleware(['auth'])->name('dashboard');
|
||||
|
||||
Route::get('/input-anak', function () {
|
||||
return view('input-anak');
|
||||
})->middleware(['auth'])->name('input-anak');
|
||||
Route::post('/input-anak', [DataAnakController::class, 'store'])->middleware(['auth'])->name('input-anak');
|
||||
Route::post('/input-anak-orang-tua', [DataAnakController::class, 'storeOrangTua'])->middleware(['auth'])->name('input-anak-orang-tua');
|
||||
|
||||
Route::get('/detail-anak/{id}', [AnakController::class, 'show'])->middleware(['auth'])->name('detail-anak');
|
||||
|
||||
Route::get('/input-statistik/{id}', [StatistikAnakController::class, 'show'])->middleware(['auth'])->name('input-statistik');
|
||||
|
||||
Route::post('/input-statistik/{id}', [StatistikAnakController::class, 'store'])->middleware(['auth'])->name('input-statistik');
|
||||
|
||||
require __DIR__.'/auth.php';
|
||||
|
||||
Route::prefix('command')->group(function () {
|
||||
Route::get('migrate', function () {
|
||||
Artisan::call('migrate');
|
||||
});
|
||||
Route::get('seed', function () {
|
||||
Artisan::call('db:seed --class RoleSeeder');
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user