Add EquipmentMasterController with authorization and equipment retrieval logic with relevant API
This commit is contained in:
@@ -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');
|
||||
// });
|
||||
|
||||
Reference in New Issue
Block a user