Add EquipmentMasterController with authorization and equipment retrieval logic with relevant API

This commit is contained in:
dhanabalan
2025-09-21 15:32:18 +05:30
parent f670793ff5
commit 4da6e97e6e
3 changed files with 157 additions and 1 deletions

View File

@@ -1,6 +1,7 @@
<?php
use App\Mail\test;
use App\Models\EquipmentMaster;
use App\Models\InvoiceValidation;
use App\Models\Plant;
use Illuminate\Support\Facades\Mail;
@@ -10,6 +11,15 @@ use Illuminate\Support\Facades\Route;
return redirect('/admin');
});
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('/scheduler', function() {
// Artisan::call('schedule:run');
// });