changed part validation uploaded image logic in sticker master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 15s
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Successful in 9s
Gemini PR Review / review (pull_request) Failing after 25s
Laravel Pint / pint (pull_request) Successful in 2m52s
Laravel Larastan / larastan (pull_request) Failing after 3m46s

This commit is contained in:
dhanabalan
2025-12-10 16:42:41 +05:30
parent 750f8520f5
commit 030013f914

View File

@@ -844,50 +844,56 @@ class StickerMasterResource extends Resource
$plantCode = $plant->code;
$sticker = StickerMaster::where('plant_id', $plantId)
->where('item_id', $itemId)
->first();
// $sticker = StickerMaster::where('plant_id', $plantId)
// ->where('item_id', $itemId)
// ->first();
if (! $sticker) {
Notification::make()
->title('Unknown Sticker Master')
->body('Sticker Master data not found.')
->danger()
->seconds(2)
->send();
}
// if (! $sticker) {
// Notification::make()
// ->title('Unknown Sticker Master')
// ->body('Sticker Master data not found.')
// ->danger()
// ->seconds(2)
// ->send();
// }
$value = $sticker->{$column};
// $value = $sticker->{$column};
if (empty($value)) {
Notification::make()
->title('Unknown Part validation')
->body("Selected validation '$column' has no value.")
->danger()
->seconds(2)
->send();
}
// if (empty($value)) {
// Notification::make()
// ->title('Unknown Part validation')
// ->body("Selected validation '$column' has no value.")
// ->danger()
// ->seconds(2)
// ->send();
// }
$newFileName = $value.'.png';
// $newFileName = $value.'.png';
$directory = "uploads/PartValidation/{$plantCode}";
$originalName = $uploadedFile->getClientOriginalName();
$directory = 'uploads/PartValidation';
$disk = Storage::disk('local');
if (! $disk->exists($directory)) {
$disk->makeDirectory($directory, 0755, true);
}
// $fullPath = Storage::disk('local')->path($directory);
// $directory = "uploads/PartValidation/{$plantCode}";
// $disk = Storage::disk('local');
// if (! $disk->exists($directory)) {
// $disk->makeDirectory($directory, 0755, true);
// }
// $path = $uploadedFile->storeAs(
// $directory,
// $newFileName,
// 'local'
// );
try {
$path = $uploadedFile->storeAs(
$directory,
$newFileName,
'local'
);
$path = $disk->putFileAs($directory, $uploadedFile, $originalName);
} catch (\Exception $e) {
Notification::make()
->title('Upload Failed')