Added dynamic plant selection based on user permissions and updated file upload path for invoices
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Gemini PR Review / Gemini PR Review (pull_request) Has been cancelled
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (pull_request) Has been cancelled
Laravel Larastan / larastan (pull_request) Has been cancelled
Laravel Pint / pint (pull_request) Has been cancelled

This commit is contained in:
dhanabalan
2026-02-06 14:24:28 +05:30
parent 6163211672
commit 9dea321111
2 changed files with 33 additions and 27 deletions

View File

@@ -37,6 +37,11 @@ class InvoiceDataValidationResource extends Resource
Forms\Components\Select::make('plant_id')
->label('Plant')
->relationship('plant', 'name')
->options(function (callable $get) {
$userHas = Filament::auth()->user()->plant_id;
return ($userHas && strlen($userHas) > 0) ? Plant::where('id', $userHas)->pluck('name', 'id')->toArray() : Plant::orderBy('code')->pluck('name', 'id')->toArray();
})
->required(),
Forms\Components\TextInput::make('distribution_channel_desc')
->label('Distribution Channel Description')
@@ -206,7 +211,7 @@ class InvoiceDataValidationResource extends Resource
$originalNameOnly = pathinfo($originalName, PATHINFO_FILENAME);
// Store manually using storeAs to keep original name
$path = $uploadedFile->storeAs('uploads/temp', $originalName, 'local'); // returns relative path
$path = $uploadedFile->storeAs('uploads/InvoiceOut', $originalName, 'local'); // returns relative path
$fullPath = Storage::disk('local')->path($path);