benjji92
benjji92
FFilament
Created by benjji92 on 9/4/2023 in #❓┊help
filamentphp admin site on a subdomain?
Would it be possible somehow to have the main site on a domain, and the /admin site on a subdomain?
5 replies
FFilament
Created by benjji92 on 8/18/2023 in #❓┊help
Can't upload more than 10mb with SpatieMediaLibraryFileUpload
In the php.ini the upload_max_filesize is 100MB and in the media-library.php i set 'max_file_size' => 1024 * 1024 * 100. But I still can not upload anything more than 10mb.
5 replies
FFilament
Created by benjji92 on 7/27/2023 in #❓┊help
filament admin site wont load properly on new vps
13 replies
FFilament
Created by benjji92 on 4/19/2023 in #❓┊help
FileUpload doesnt work properly
I have an action that uploads an excel file and run a script with the data in it, then deletes the uploaded file since its no longer needed. ->actions([ Tables\Actions\Action::make('Run') ->label('Run script') ->color('danger') ->size('lg') ->icon('heroicon-o-play') ->requiresConfirmation() ->form([ FileUpload::make('excel') ->label('Excel') ->acceptedFileTypes(['application/vnd.openxmlformats-officedocument.spreadsheetml.sheet']) ->preserveFilenames(), ]) ->action(function ($data) { $path = $data['excel']; $deleteScript = new Script(); $deleteScript->delete($path); Storage::delete($path); }) class DeleteScript { public function delete($path) { $data = Excel::toArray([], $path); foreach ($data as $row) { $videoCode = trim(implode('', $row[0])); if(empty($videoCode)){ continue; } //Log::info("videocode: $videoCode"); $video = Videos::where('code', $videoCode)->delete(); } } } For example: I upload a delete.xlsx file, but I get the following error: Could not find zip member zip://C:\laragon\www\fanny\storage\framework\cache\laravel-excel\laravel-excel-yBCw78HjXxAlznjDQ609T9mkdHe52RYz.xlsx#_rels/.rels I found out that if I place this delete.xlsx in the \storage\app folder, the code runs without error, succesfully deleting the data given in the excel file. How is this related? The uploaded excel file goes to the \storage\app\public folder. What goes wrong here?
3 replies
FFilament
Created by benjji92 on 4/14/2023 in #❓┊help
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.
13 replies
FFilament
Created by benjji92 on 4/11/2023 in #❓┊help
how to pass uploaded file as variable in table builder?
public static function table(Table $table): Table { return $table ->columns([ // ]) ->filters([ // ]) ->actions([ Tables\Actions\Action::make('Run') ->label('Run script') ->color('danger') ->size('lg') ->icon('heroicon-o-play') ->requiresConfirmation() ->form([ SpatieMediaLibraryFileUpload::make('excel') ->label('Excel') ->collection('excel') ->preserveFilenames(), ]) ->action (function (Request $request) { $command = new \App\Console\Commands\DeleteData(); $file = $request->file('excel'); return $command->handle($file); }) ]) ->bulkActions([ // ]); } i would like to pass the excel file i upload here to the deletescript, but i dont understand how this works class DeleteScript { public function delete() { $data = Excel::toArray([], $file); $dataChunks = array_chunk($data[0], 25); foreach ($dataChunks as $chunk) { //rest of the code } } } class DeleteData extends Command { protected $signature = 'delete:data'; protected $description = 'Delete Data'; public function handle() { (new DeleteScript())->delete(); return Command::SUCCESS; } }
17 replies
FFilament
Created by benjji92 on 4/5/2023 in #❓┊help
upload an excel and start a script manually from admin panel
I want to make a new modul in the admin panel where I can upload excel files and start various scripts for example: a script that imports data to the database from the uploaded excel file. Is this possible to do with filamentphp?
5 replies