Laravel Excel not running in action

I have a csv importer built using Laravel Excel that works when tested in a seeder and in Tinker, but when using it with a file upload form inside of a modal, it seems like it's being skipped entirely inside of the action (doesn't even throw exceptions when there is an issue). Other code before and after the import inside of the action runs fine. Can anyone spot something I'm doing wrong?

Action::make('import')
                ->form([
                    FileUpload::make('data_file')
                        ->acceptedFileTypes(['text/csv'])
                        ->maxFiles(1)
                        ->storeFileNamesIn('file_name')
                ])
                ->action(function (array $data): void {
                    //dd($data);
                    //try {
                        Excel::import(new SitesImport, 'test_data/test_sites.csv'); //Manual file name for debugging
                    //} catch (ValidationException $e) {
                    //    dd($e->failures());
                    //}

                    Notification::make()
                        ->title('Imported: ' . $data['file_name'])
                        ->success()
                        ->send();
                })
Solution
So it turns out you were on the right track. I tried giving a bad file name intentionally, and it didn't change the behavior (no exception), which made me realize that the app must be looking for the data in a different place than when I run it from the command line in tinker or a seeder. Sure enough, it's because my test data is in it's own project folder, and moving it to the storage folder fixed it.
Was this page helpful?