feat: initial project setup with Laravel 12 and Filament v4
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\SyncController;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::prefix('sync')->group(function () {
|
||||
Route::get('export', [SyncController::class, 'export']);
|
||||
Route::post('apply', [SyncController::class, 'apply']);
|
||||
Route::get('file', [SyncController::class, 'downloadFile']);
|
||||
Route::post('receive-file', [SyncController::class, 'receiveFile']);
|
||||
});
|
||||
@@ -0,0 +1,8 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::get('/', fn () => redirect('/admin'));
|
||||
|
||||
Route::get('/locale/{locale}', function (string $locale) {
|
||||
if (in_array($locale, config('app.available_locales', ['fa', 'en']))) {
|
||||
session(['locale' => $locale]);
|
||||
}
|
||||
return redirect()->back();
|
||||
})->name('locale.switch');
|
||||
|
||||
Route::middleware(['web', 'auth'])->group(function () {
|
||||
Route::get('/prescription/{prescription}/print', [\App\Http\Controllers\PrescriptionPrintController::class, 'print'])
|
||||
->name('prescription.print');
|
||||
|
||||
Route::get('/patient/{patient}/print-lab', [\App\Http\Controllers\PrescriptionPrintController::class, 'printPatientLab'])
|
||||
->name('patient.print.lab');
|
||||
|
||||
Route::get('/prescription/{prescription}/print-admission', [\App\Http\Controllers\PrescriptionPrintController::class, 'printAdmission'])
|
||||
->name('prescription.print.admission');
|
||||
|
||||
Route::get('/surgery-appointment/{patient}/print-admission', [\App\Http\Controllers\PrescriptionPrintController::class, 'printSurgeryAdmission'])
|
||||
->name('surgery-appointment.print.admission');
|
||||
|
||||
Route::post('/admin/sync/run', function () {
|
||||
$service = \App\Services\SyncService::fromConfig();
|
||||
|
||||
if (! $service->isConfigured()) {
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'report' => [__('navigation.sync.error_not_configured')],
|
||||
], 422);
|
||||
}
|
||||
|
||||
$result = $service->sync();
|
||||
|
||||
return response()->json($result);
|
||||
})->name('sync.run');
|
||||
|
||||
Route::get('/admin/backup/download', function () {
|
||||
$data = [
|
||||
'exported_at' => now()->toDateTimeString(),
|
||||
'last_sync_id' => \App\Models\SyncLog::lastSyncId(),
|
||||
'changes' => \App\Models\SyncLog::all()->toArray(),
|
||||
];
|
||||
$filename = 'matab-backup-' . now()->format('Y-m-d_H-i-s') . '.json';
|
||||
return response()->streamDownload(function () use ($data) {
|
||||
echo json_encode($data, JSON_UNESCAPED_UNICODE | JSON_PRETTY_PRINT);
|
||||
}, $filename, ['Content-Type' => 'application/json']);
|
||||
})->name('backup.download');
|
||||
});
|
||||
Reference in New Issue
Block a user