still struggling to pass data from FileUpload in filament resource to my command script

As the title suggests, I would like my script to read the data and run, according to excels I upload. Currently it only works with hardcoded excel files that I store in storage/app/public. Here is a github gist link to my code. https://gist.github.com/Benjji92/42839a5088fb052e624c4d480672e94e Any help would be much appriciated as Im struggling to do this for the past days.
Gist
app\Console\Commands\DeleteData.php
GitHub Gist: instantly share code, notes, and snippets.
8 Replies
Dan Harrin
Dan Harrin2y ago
1) dont use SpatieMediaLibraryFileUpload, just FileUpload 2) in the action() function, you will recieve $data. that will contain the path to the uploaded file which you can pass to the command
benjji92
benjji92OP2y ago
my bad i forgot to change it in github gist but im actually using just FileUpload when i dd($data) it only contains the name of the uploaded file
Dan Harrin
Dan Harrin2y ago
yeah whats the problem thats the file that you can get data from
benjji92
benjji92OP2y ago
im a self made beginner programmer so im not exactly sure how to do this, i thought since there is only the name in the dd() the path is missing from there
Dan Harrin
Dan Harrin2y ago
its in whatever storage disk you told it to upload to, public disk by default have a look in your file explorer
benjji92
benjji92OP2y ago
i just noticed that it gets saved there only after i press the run button for the script, so i might need to do a seperate Action for the upload before the scripts Action for it to work
Dan Harrin
Dan Harrin2y ago
attach the file, click Import and then the file is uploaded and the command will run
benjji92
benjji92OP2y ago
i wanted to do the file upload and run the script with one button click but i guess its not doable like this
Want results from more Discord servers?
Add your server