Initial commit for new repo
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 1m4s
This commit is contained in:
187
routes/api.php
Normal file
187
routes/api.php
Normal file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
use App\Http\Controllers\CharacteristicsController;
|
||||
use App\Http\Controllers\EquipmentMasterController;
|
||||
use App\Http\Controllers\InvoiceValidationController;
|
||||
use App\Http\Controllers\MachineController;
|
||||
use App\Http\Controllers\MfmParameterController;
|
||||
use App\Http\Controllers\ModuleChartController;
|
||||
use App\Http\Controllers\ModuleController;
|
||||
use App\Http\Controllers\ModuleFGLineController;
|
||||
use App\Http\Controllers\ModuleFilterController;
|
||||
use App\Http\Controllers\ModuleFilterDataController;
|
||||
use App\Http\Controllers\ModuleGuardDayCountController;
|
||||
use App\Http\Controllers\ModuleGuardHourlyCountController;
|
||||
use App\Http\Controllers\ModuleGuardNameController;
|
||||
use App\Http\Controllers\ModuleInvoiceDataController;
|
||||
use App\Http\Controllers\ModuleInvoiceQuantityController;
|
||||
use App\Http\Controllers\ModuleInvoiceTypeController;
|
||||
use App\Http\Controllers\ModulePlantController;
|
||||
use App\Http\Controllers\ModulePlantLineController;
|
||||
use App\Http\Controllers\ModuleProductionFGLineController;
|
||||
use App\Http\Controllers\ModuleProductionLineStopController;
|
||||
use App\Http\Controllers\ModuleProductionOrderDataController;
|
||||
use App\Http\Controllers\ObdController;
|
||||
use App\Http\Controllers\PalletController;
|
||||
use App\Http\Controllers\PdfController;
|
||||
use App\Http\Controllers\PlantController;
|
||||
use App\Http\Controllers\ProductionStickerReprintController;
|
||||
use App\Http\Controllers\SapFileController;
|
||||
use App\Http\Controllers\StickerMasterController;
|
||||
// use App\Http\Controllers\TelegramController;
|
||||
use App\Http\Controllers\TestingPanelController;
|
||||
use App\Http\Controllers\UserController;
|
||||
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
// Route::get('/user', function (Request $request) {
|
||||
// // return "test";
|
||||
|
||||
// $item = \App\Models\Item::get();
|
||||
|
||||
// return $item;
|
||||
// });
|
||||
|
||||
|
||||
// Route::post('/user/update', function (Request $request) {
|
||||
// // Return the request data as JSON
|
||||
|
||||
// // dd($request);
|
||||
// return response()->json([
|
||||
// 'message' => 'User updated successfully',
|
||||
// 'data' => $request->all()
|
||||
// ]);
|
||||
// });
|
||||
|
||||
|
||||
// Route::middleware('auth.basic')->post('/user/update', function (Request $request) {
|
||||
// return response()->json([
|
||||
// 'message' => 'Authenticated via Basic Auth',
|
||||
// 'user' => $request->user(),
|
||||
// 'data' => $request->all()
|
||||
// ]);
|
||||
// });
|
||||
|
||||
|
||||
Route::post('obd/store-data', [ObdController::class, 'store']);
|
||||
|
||||
Route::get('obd/get-test-datas', [ObdController::class, 'get_test']);
|
||||
|
||||
Route::get('obd/store-data/get', [ObdController::class, 'get_obd']);
|
||||
|
||||
Route::get('plant/get-all-data', [PlantController::class, 'get_all_data']);
|
||||
|
||||
Route::get('sticker/get-master-type-data', [StickerMasterController::class, 'get_master_type']);
|
||||
|
||||
Route::get('/download-qr-pdf/{palletNo}', [PalletController::class, 'downloadQrPdf'])->name('download-qr-pdf');
|
||||
|
||||
Route::get('/download-reprint-qr-pdf/{palletNo}', [PalletController::class, 'downloadReprintQrPdf'])->name('download-reprint-qr-pdf');
|
||||
|
||||
Route::get('/download-qr1-pdf/{palletNo}', [ProductionStickerReprintController::class, 'downloadQrPdf'])->name('download-qr1-pdf');
|
||||
|
||||
//Production Dashboard Controller
|
||||
|
||||
Route::get('get/module-name/data', [ModuleController::class, 'get_module']);
|
||||
|
||||
Route::get('get/modulechart-name/data', [ModuleChartController::class, 'get_moduleChart']);
|
||||
|
||||
Route::get('get/moduleplant-name/data', [ModulePlantController::class, 'get_modulePlant']);
|
||||
|
||||
Route::get('get/module-plantline-name/data', [ModulePlantLineController::class, 'get_modulePlantLine']);
|
||||
|
||||
Route::get('get/module-line-filter-name/data', [ModuleFilterController::class, 'get_moduleFilter']);
|
||||
|
||||
Route::get('get/module-fgline-filter-list/data', [ModuleProductionFGLineController::class, 'get_moduleFGFilterList']);
|
||||
|
||||
Route::get('get/module-fgline-filter-name/data', [ModuleFGLineController::class, 'get_moduleFGFilter']);
|
||||
|
||||
Route::get('get/module-filter-value/data', [ModuleFilterDataController::class, 'get_moduleFilterData']);
|
||||
|
||||
Route::get('get/module-production-order/data', [ModuleProductionOrderDataController::class, 'get_moduleProductionOrder']);
|
||||
|
||||
Route::get('get/module-production-linestop/data', [ModuleProductionLineStopController::class, 'get_moduleProductionLineStop']);
|
||||
|
||||
//Invoice Dashboard Controller
|
||||
|
||||
Route::get('get/module-invoice-type/data', [ModuleInvoiceDataController::class, 'get_invoiceData']);
|
||||
|
||||
Route::get('get/module-invoice-filter/data', [ModuleInvoiceTypeController::class, 'get_invoiceFilter']);
|
||||
|
||||
Route::get('get/module-invoice-count/data', [ModuleInvoiceTypeController::class, 'get_invoiceCountData']);
|
||||
|
||||
Route::get('get/module-invoice-quantity/data', [ModuleInvoiceQuantityController::class, 'get_invoiceQuantityData']);
|
||||
|
||||
//Guard Dashboard Controller
|
||||
|
||||
Route::get('get/module-guard-day/data', [ModuleGuardDayCountController::class, 'get_guardDay_countData']);
|
||||
|
||||
Route::get('get/module-guard-hourly/data', [ModuleGuardHourlyCountController::class, 'get_guardDay_hourlyData']);
|
||||
|
||||
Route::get('get/module-guard-name/data', [ModuleGuardNameController::class, 'get_guard_name_Data']);
|
||||
|
||||
//Power house controller
|
||||
|
||||
Route::get('get/mfm-parameter/data', [MfmParameterController::class, 'get_mfm_parameter']);
|
||||
|
||||
Route::get('get/mfm-parameterid/data', [MfmParameterController::class, 'get_mfm_parameterid']);
|
||||
|
||||
//Invoice Validation Controller
|
||||
|
||||
Route::post('serial-invoice/store-data', [InvoiceValidationController::class, 'serialInvoice']);
|
||||
|
||||
Route::post('material-invoice/store-data', [InvoiceValidationController::class, 'materialInvoice']);
|
||||
|
||||
//Testing panel Controller
|
||||
|
||||
Route::get('testing/user/get-data', [UserController::class, 'get_testing_data']);
|
||||
|
||||
Route::get('testing/item/get-master-data', [TestingPanelController::class, 'get_motor_master']);
|
||||
|
||||
Route::get('machine/get-all-data', [MachineController::class, 'get_all_data']);
|
||||
|
||||
Route::get('machine/get-data', [MachineController::class, 'get_data']);
|
||||
|
||||
Route::get('testing/equipment/get-master-data', [EquipmentMasterController::class, 'equipmentMasterData']);
|
||||
|
||||
Route::post('testing/reading/store-data', [TestingPanelController::class, 'store']);
|
||||
|
||||
Route::get('get-pdf', [PdfController::class, 'getPdf']);
|
||||
|
||||
Route::get('process-order/details', [PdfController::class, 'getProcessOrderData']);
|
||||
|
||||
Route::post('process-order', [PdfController::class, 'storeProcessOrderData']);
|
||||
|
||||
Route::get('sap/files', [SapFileController::class, 'readFiles']);
|
||||
|
||||
//..Laser Marking - Characteristics
|
||||
|
||||
Route::get('laser/item/get-master-data', [StickerMasterController::class, 'get_master']);
|
||||
|
||||
Route::post('laser/route/data', [CharacteristicsController::class, 'test']);//->withoutMiddleware(VerifyCsrfToken::class)
|
||||
|
||||
// Route::get('get-characteristics/master-data', [CharacteristicsController::class, 'getCharacteristicsMaster']);
|
||||
|
||||
Route::get('laser/characteristics/get', [CharacteristicsController::class, 'getClassChar']);
|
||||
|
||||
Route::get('laser/characteristics/check', [CharacteristicsController::class, 'checkClassChar']);
|
||||
|
||||
Route::post('laser/characteristics/data', [CharacteristicsController::class, 'storeClassChar']);
|
||||
|
||||
Route::post('laser/characteristics/status', [CharacteristicsController::class, 'storeLaserStatus']);
|
||||
|
||||
Route::get('characteristics/get/master', [CharacteristicsController::class, 'getCharMaster']);
|
||||
|
||||
//GR Master PDF and Serial Number
|
||||
|
||||
Route::get('grNumber-pdf', [PdfController::class, 'getGRPdf']);
|
||||
|
||||
Route::get('grmaster-sno', [PdfController::class, 'getGRSerial']);
|
||||
|
||||
Route::post('grmaster-sno-update', [PdfController::class, 'updateGR']);
|
||||
|
||||
Route::post('file/store', [SapFileController::class, 'store'])->name('file.store');
|
||||
|
||||
// Route::post('send-telegram', [TelegramController::class, 'sendMessage']);
|
||||
|
||||
// Route::post('invoice-exit', [InvoiceValidationController::class, 'handle']);
|
||||
101
routes/console.php
Normal file
101
routes/console.php
Normal file
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Foundation\Inspiring;
|
||||
use Illuminate\Support\Facades\Artisan;
|
||||
|
||||
|
||||
|
||||
Artisan::command('inspire', function () {
|
||||
$this->comment(Inspiring::quote());
|
||||
})->purpose('Display an inspiring quote');
|
||||
|
||||
|
||||
Artisan::command('auto:scheduler', function () {
|
||||
$this->call('custom:scheduler');
|
||||
})->everyMinute();
|
||||
|
||||
|
||||
// Schedule::command('send:invoice-report');
|
||||
// Schedule::command('send:production-report');
|
||||
|
||||
// app()->booted(function () {
|
||||
// $schedule = app(Schedule::class);
|
||||
|
||||
// // $schedule->command('report:send-daily-production')->dailyAt('07:59');
|
||||
// // Production report scheduling
|
||||
// $productionRules = AlertMailRule::where('module', 'ProductionQuantities')
|
||||
// ->where('rule_name', 'ProductionMail')
|
||||
// ->select('plant', 'schedule_type')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// foreach ($productionRules as $rule) {
|
||||
// $type = $rule->schedule_type;
|
||||
// $plantId = $rule->plant;
|
||||
|
||||
// $command = $schedule->command('send:production-report', [$type, $plantId]);
|
||||
// // ->appendOutputTo(storage_path('logs/scheduler.log'));
|
||||
|
||||
// switch ($type) {
|
||||
// case 'Live':
|
||||
// $command->everyMinute();
|
||||
// break;
|
||||
// case 'Hourly':
|
||||
// $command->hourly();
|
||||
// break;
|
||||
// case 'Daily':
|
||||
// $command->dailyAt('07:59');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Invoice report scheduling
|
||||
// $invoiceRules = AlertMailRule::where('module', 'InvoiceValidation')
|
||||
// ->select('plant', 'schedule_type')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// foreach ($invoiceRules as $rule) {
|
||||
// $type = $rule->schedule_type;
|
||||
// $plantId = $rule->plant;
|
||||
|
||||
// $command = $schedule->command('send:invoice-report', [$type, $plantId]);
|
||||
|
||||
// switch ($type) {
|
||||
// case 'Live':
|
||||
// $command->everyMinute();
|
||||
// break;
|
||||
// case 'Hourly':
|
||||
// $command->hourly();
|
||||
// break;
|
||||
// case 'Daily':
|
||||
// $command->dailyAt('07:59');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
// // Invoice Data Report Scheduling
|
||||
// $invoiceDataRules = AlertMailRule::where('module', 'InvoiceDataReport')
|
||||
// ->select('plant', 'schedule_type')
|
||||
// ->distinct()
|
||||
// ->get();
|
||||
|
||||
// foreach ($invoiceDataRules as $rule) {
|
||||
// $type = $rule->schedule_type;
|
||||
// $plantId = $rule->plant;
|
||||
|
||||
// $command = $schedule->command('send:invoice-data-report', [$type, $plantId]);
|
||||
|
||||
// switch ($type) {
|
||||
// case 'Live':
|
||||
// $command->everyMinute();
|
||||
// break;
|
||||
// case 'Hourly':
|
||||
// $command->hourly();
|
||||
// break;
|
||||
// case 'Daily':
|
||||
// $command->dailyAt('10:00');
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// });
|
||||
172
routes/web.php
Normal file
172
routes/web.php
Normal file
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
use App\Mail\test;
|
||||
use App\Models\EquipmentMaster;
|
||||
use App\Models\InvoiceValidation;
|
||||
use App\Models\Plant;
|
||||
use App\Models\User;
|
||||
use Filament\Facades\Filament;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Http\Request;
|
||||
use thiagoalessio\TesseractOCR\TesseractOCR;
|
||||
use App\Http\Livewire\CustomLogin;
|
||||
|
||||
Route::get('/', function () {
|
||||
return redirect('/admin');
|
||||
});
|
||||
|
||||
// routes/web.php
|
||||
Route::post('/save-serials-to-session', function (Request $request) {
|
||||
session(['serial_numbers' => $request->serial_numbers]);
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'serial_numbers' => session('serial_numbers'),
|
||||
]);
|
||||
});
|
||||
|
||||
Route::get('/part-validation-image/{plant}/{filename}', function ($plant, $filename) {
|
||||
$path = storage_path("app/private/uploads/PartValidation/{$plant}/{$filename}");
|
||||
|
||||
if (!file_exists($path)) {
|
||||
abort(404, 'Image not found');
|
||||
}
|
||||
|
||||
return response()->file($path);
|
||||
})->name('part.validation.image');
|
||||
|
||||
// web.php
|
||||
Route::post('/temp-upload', function (Request $request) {
|
||||
if (!$request->hasFile('photo')) {
|
||||
return response()->json(['success' => false], 400);
|
||||
}
|
||||
|
||||
$file = $request->file('photo');
|
||||
$filename = 'capture_' . time() . '.jpeg';
|
||||
$path = $file->storeAs('temp', $filename, 'local'); // storage/app/temp
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'path' => $path,
|
||||
]);
|
||||
});
|
||||
|
||||
Route::post('/verify-ocr', function (Request $request) {
|
||||
|
||||
if (!$request->has('path')) {
|
||||
return response()->json(['success' => false, 'error' => 'No file path provided']);
|
||||
}
|
||||
|
||||
$filePath = storage_path('app/private/temp/' . basename($request->path));
|
||||
|
||||
if (!file_exists($filePath)) {
|
||||
return response()->json(['success' => false, 'error' => 'File not found']);
|
||||
}
|
||||
|
||||
try {
|
||||
// $text = (new TesseractOCR($filePath))->lang('eng')->run();
|
||||
$text = (new TesseractOCR($filePath))
|
||||
->executable('/usr/bin/tesseract')
|
||||
->lang('eng')
|
||||
->psm(6) // treats the image as a block of text
|
||||
->config('tessedit_char_whitelist', '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz')
|
||||
->run();
|
||||
|
||||
$text = trim($text); // remove whitespace
|
||||
|
||||
if (empty($text)) {
|
||||
// No text found
|
||||
return response()->json(['success' => true, 'text' => 'Text not found']);
|
||||
}
|
||||
|
||||
//return response()->json(['success' => true, 'text' => $text]);
|
||||
$lines = preg_split('/\r\n|\r|\n/', $text);
|
||||
$serials = array_filter(array_map('trim', $lines), fn($line) => preg_match('/^[A-Za-z0-9]+$/', $line));
|
||||
|
||||
return response()->json([
|
||||
'success' => true,
|
||||
'text' => array_values($serials) // reindex array
|
||||
]);
|
||||
}
|
||||
//catch (\Exception $e) {
|
||||
// return response()->json(['success' => false, 'error' => $e->getMessage()]);
|
||||
// }
|
||||
catch (\Exception $e) {
|
||||
// Log the full exception class and message
|
||||
\Log::error('Tesseract OCR failed', [
|
||||
'exception_class' => get_class($e),
|
||||
'message' => $e->getMessage(),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString(),
|
||||
]);
|
||||
|
||||
// Return detailed error for debugging
|
||||
return response()->json([
|
||||
'success' => false,
|
||||
'error' => $e->getMessage(),
|
||||
'exception_class' => get_class($e),
|
||||
'file' => $e->getFile(),
|
||||
'line' => $e->getLine(),
|
||||
'trace' => $e->getTraceAsString(),
|
||||
]);
|
||||
}
|
||||
});
|
||||
|
||||
Route::get('/download/{equipmentNumber}', function ($equipmentNumber) {
|
||||
$model = EquipmentMaster::where('equipment_number', $equipmentNumber)->firstOrFail();
|
||||
|
||||
if (! $model->attachment || ! Storage::disk('local')->exists($model->attachment)) {
|
||||
abort(404, 'File not found.');
|
||||
}
|
||||
return Storage::disk('local')->download($model->attachment);
|
||||
})->name('download.attachment');
|
||||
|
||||
// Route::get('/admin/forgot-password', function () {
|
||||
// return view('auth.forgot-password');
|
||||
// })->name('filament.admin.forgot-password');
|
||||
|
||||
|
||||
// Route::post('/admin/forgot-password', function(Request $request){
|
||||
|
||||
// $validator = Validator::make($request->all(), [
|
||||
// 'email'=>'required|email',
|
||||
// 'old_password'=>'required',
|
||||
// 'password'=>'required',
|
||||
// 'password_confirmation'=>'required'
|
||||
// ]);
|
||||
|
||||
// if($validator->fails()){
|
||||
// return response()->json([
|
||||
// 'emailError' => $validator->errors()->first('email'),
|
||||
// 'oldPasswordError' => $validator->errors()->first('old_password'),
|
||||
// 'newPasswordError' => $validator->errors()->first('password'),
|
||||
// 'confirmPasswordError' => $validator->errors()->first('password_confirmation')
|
||||
// ]);
|
||||
// }
|
||||
|
||||
// $user = User::where('email',$request->email)->first();
|
||||
// if(!$user){
|
||||
// return response()->json(['passwordError'=>'No user found with this email.']);
|
||||
// }
|
||||
|
||||
// if(!Hash::check($request->old_password, $user->password)){
|
||||
// return response()->json(['oldPasswordError'=>'Old password does not match']);
|
||||
// }
|
||||
|
||||
// if($request->password != $request->password_confirmation){
|
||||
// return response()->json(['newPasswordError'=>'New password and confirm password do not match']);
|
||||
// }
|
||||
|
||||
// $user->password = Hash::make($request->password);
|
||||
// $user->save();
|
||||
|
||||
// return response()->json(['success'=>'Password changed successfully!']);
|
||||
// })->name('filament.admin.forgot-password.otp');
|
||||
|
||||
|
||||
// Route::post('/admin/check-email', function(Request $request){
|
||||
// $request->validate(['email' => 'required|email']);
|
||||
// $exists = User::where('email', $request->email)->first();
|
||||
// return response()->json(['exists' => $exists]);
|
||||
// })->name('admin.check-email');
|
||||
Reference in New Issue
Block a user