StanProg
StanProg
FFilament
Created by StanProg on 7/17/2024 in #❓┊help
FileUpload issue with multiple machines
I'm using the FileUpload component, to upload a files in S3. Sample code:
Action::make('i-r')
->button()
->form([
FileUpload::make('r')
->disk('s3')
->directory('tmp')
->visibility('private')
])
->action(function (array $data): void {
if ($data['r'] === null) {
Log::error("Uploading Failed!");
return;
}
dispatch(... job that gets the file and process it);
}),
Action::make('i-r')
->button()
->form([
FileUpload::make('r')
->disk('s3')
->directory('tmp')
->visibility('private')
])
->action(function (array $data): void {
if ($data['r'] === null) {
Log::error("Uploading Failed!");
return;
}
dispatch(... job that gets the file and process it);
}),
When I use only one app machine i.e. vm (scaling), the upload works correctly i.e. 1. the file is uploaded correctly "storage\app\livewire-tmp" when I pick it 2. the file is uploaded to "s3" "tmp" folder when I click the Submit button When I use multiple app machines the file gets uploaded to "storage\app\livewire-tmp", under name like 'JBexfBvW1lJgkJyjxaWYasj09aUWZ3-metaU2FsZXNfUmVwb3J0X0RFQ18yMDIzX0hleUhhcHBpbmVzc19QTC5DU1Y=-.csv' (including the single quotes, which is strange), but when I click the Submit button, it's not uploaded to the S3 folder. In the multiple app engines case it does not work even if it's executed on the app engine on which it was previously worked perfectly (in single single engine mode) Do you have any idea, why when adding second app engine for my application, the uploads stops working? Is there something that I have to configure additionally? Any help will be appreciated.
4 replies
FFilament
Created by StanProg on 4/17/2024 in #❓┊help
Redirect from Livewire component boot()
I have a Livewire component with a form and in the boot() method I conditionally redirect to the dashboard. Unfortunately that redirect() does not work (it's executed, but does not redirect) and the getFormSchema() gets executed, while it shouldn't. Can somebody point what I'm doing wrong? Here's a sample code:
namespace App\Http\Livewire;
class XXX extends Component implements HasForms
{
public function boot()
{
return redirect()->route('filament.pages.dashboard');
}

protected function getFormSchema(): array
{
// this gets executed
}
}
namespace App\Http\Livewire;
class XXX extends Component implements HasForms
{
public function boot()
{
return redirect()->route('filament.pages.dashboard');
}

protected function getFormSchema(): array
{
// this gets executed
}
}
3 replies
FFilament
Created by StanProg on 2/29/2024 in #❓┊help
Tag files uploaded to S3 via FileUpload
Is there a way, to tag files, uploaded to Amazon S3 via Filaments FileUpload::make()? When I use Storage::disk('s3')->put() there is a parameter for that, like ['Tagging' => 'type=invoice'].
2 replies
FFilament
Created by StanProg on 10/20/2023 in #❓┊help
Tagging S3 Uploads
I'm uploading files to S3 via FileUpload::make()->disk('s3'), but I can't find a way to tag the uploads. If I manually upload them I use a syntax like that: Storage::disk('s3')->put($path, $pdf->output(), ['Tagging' => 'type=gdpr']); Is there a way to use that Tagging in the context of FileUpload::make()?
3 replies
FFilament
Created by StanProg on 9/20/2023 in #❓┊help
Wrong money formatting
I'm formatting the money with ->money() on the TextColumn. EUR (€ 27,90) & PLN (27,90 zł) look OK, while USD ($0.28) & CHF (CHF0.28) are divided by 100. Example call:
Tables\Columns\TextColumn::make('regular_price')
->label('Regular Price'))
->money('CHF')
->toggleable(),
Tables\Columns\TextColumn::make('regular_price')
->label('Regular Price'))
->money('CHF')
->toggleable(),
The data comes directly from the DB, returned with Eloquent. Am I missing something? I noticed that this is only for the currencies that have in config/money.php 'decimal_mark' => '.'. If I change that separator to ',' at least he amounts are not multiplied by 100, like for CHF it displays CHF27,90.
2 replies
FFilament
Created by StanProg on 9/18/2023 in #❓┊help
Defining notifications polling interval per component?
I have a Database notification from a Job that appears a minute or more after it's being added. At the notification icon I see in the soruce code: wire:poll.60s Is there a way to change that value for specific component?
6 replies
FFilament
Created by StanProg on 9/15/2023 in #❓┊help
Is there a way to send Database notifications from Job?
I read about Broadcast notifications and that they can be used to send notifications from job, but I was wondering if there is a way to accomplish that without Broadcast notifications? Like with Database notifications that get fetched?
9 replies
FFilament
Created by StanProg on 9/14/2023 in #❓┊help
Sending Notification from Job requires page reload
I have a Livewire component that has a BulkAction. When it's clicked it dispatches a Job that does some work and then sends a DB Notification to the current user. All works fine, except that I have to reload the current page to be able to see the notification. I tried adding event(new DatabaseNotificationsSent($user)); after notification is ->send();, but this does not solve the problem. Ex:
->sendToDatabase($user)
->send();
->sendToDatabase($user)
->send();
Any ideas?
2 replies
FFilament
Created by StanProg on 9/4/2023 in #❓┊help
How to get the error, when FileUpload result is NULL?
I have a custom header action defined in table() via Action::make->->form([FileUpload::make()]). I also have ->action(function (array $data): void {...} $data is an array of the custom elements, like $data['priceList'] for the FileUpload. In my case this $data['priceList'] is a string representing the Amazon S3 path to the file, like aaa\myfile.csv. The problem is that in some cases this $data['priceList'] is NULL and whenI check the file is not uploaded to S3. Question: Is there a way to see what error occurred so I can properly notify the user that is trying to upload the file? So far I just get NULL and the file is not uplaoded.
2 replies
FFilament
Created by StanProg on 8/29/2023 in #❓┊help
BulkAction action() is not executing on click
I have defined a BulkAction like that:
BulkAction::make('test')
->label('test')
->action(function (Collection $records) {
Notification::make()
->title('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
->send();
}),
BulkAction::make('test')
->label('test')
->action(function (Collection $records) {
Notification::make()
->title('XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
->send();
}),
The button appears (and it was working before). Now it seems that the action() is not executed. I ran artisan optimize:clear to clear the caches, and npm run build just in case, but still the action() mehtod is not called - as it does not accept the click on the button. Any ideas how can I debug that?
1 replies
FFilament
Created by StanProg on 8/25/2023 in #❓┊help
BulkAction with polling within action closure
I have a BulkAction that generates a PDF file and force downloads it. The problem is that the generation takes too long (60s+) and the server times out. My idea is in the BulkAction action() closure to dispatch the job that generates that file and uploads it. It will keep the state of the job in DB so I need to periodically check if it's generated & store and when it is, to force-download it. I read about polling in Livewire and got that <div wire:poll="foo"> which I thought to render within this closure, it should call the "foo" action, which action should check the DB if the file is uploaded and will force-download it. The think in the last paragraph did not worked though as the "foo" action is not being executed. Do you have any ideas why is that, or other ideas of how to solve my problem?
4 replies
FFilament
Created by StanProg on 8/21/2023 in #❓┊help
Downgrading issues from v3 to v2
Since upgrading to v3 turned into 2 weeks nightmare, I decided to downgrade to v2. What I did so far:
composer update
removed "node_modules" & executed "sudo npm install"
php artisan optimize:clear
composer update
removed "node_modules" & executed "sudo npm install"
php artisan optimize:clear
Unfortunately this was not enought and I have broken UI of the app: - logo missing - main content is over the left menu - missing user menu items - edit modals X misplaced and many more UI gliteches Should I run something else, so this could be cleanly downgraded? I'm using GIT so this branch is purely v2 - no changes from v3, neither automated, neither custom P.S. Note that my production app, based on the same branch is OK, so it should be something local.
8 replies
FFilament
Created by StanProg on 8/17/2023 in #❓┊help
ERR_MODULE_NOT_FOUND on npm run build
I've executed npm run build as I have a layout issues (2 weeks can't upgrade our app to v3) and I got the following error
node:internal/errors:491
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/vagrant/node_modules/vite/dist/node/cli.js' imported from /vagrant/node_modules/vite/bin/vite.js
at new NodeError (node:internal/errors:400:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.13.0
node:internal/errors:491
ErrorCaptureStackTrace(err);
^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/vagrant/node_modules/vite/dist/node/cli.js' imported from /vagrant/node_modules/vite/bin/vite.js
at new NodeError (node:internal/errors:400:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:842:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ESMLoader.import (node:internal/modules/esm/loader:525:22)
at importModuleDynamically (node:internal/modules/esm/translators:110:35)
at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14) {
code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.13.0
I see that the folder node_modules/vite/dist/node/ does not exist in my system. Is there something that I can do, like to reinstall some module or to do something else to fix that issue?
2 replies
FFilament
Created by StanProg on 8/15/2023 in #❓┊help
adding user-menu.start element
4 replies
FFilament
Created by StanProg on 8/11/2023 in #❓┊help
Migration of v2 layout options to v3
In v2 we had 'layout' section in config/filament.php, where we could configure some of the layout options. Example: https://gist.github.com/StanProg/1372edb3d4e3ae0f0b8002a7fa5d1d1e How could we set these options in v3? So far I found only "max_content_width" as $panel->maxContentWidth
5 replies
FFilament
Created by StanProg on 8/11/2023 in #❓┊help
Does php artisan filament:install makes changed to the Database?
I have a production database linked to my v2 app. After calling php artisan filament:install as part of the v3 upgrade process will it make changes to the database or just to the file system?
5 replies
FFilament
Created by StanProg on 8/10/2023 in #❓┊help
Target class [translator] does not exist.
This error appeared when I upgraded v3.0.12 => v3.0.14. Does anybody have any idea what is broken is 3.0.13 or 3.0.14? Maybe translation engine is no longer available for AppPanelProvider?
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

Illuminate\Contracts\Container\BindingResolutionException

Target class [translator] does not exist.

at vendor/laravel/framework/src/Illuminate/Container/Container.php:914
910▕
911▕ try {
912▕ $reflector = new ReflectionClass($concrete);
913▕ } catch (ReflectionException $e) {
➜ 914▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
915▕ }
916▕
917▕ // If the type is not instantiable, the developer is attempting to resolve
918▕ // an abstract type such as an Interface or Abstract Class and there is

+9 vendor frames
10 app/Providers/Filament/AppPanelProvider.php:229

11 app/Providers/Filament/AppPanelProvider.php:84
App\Providers\Filament\AppPanelProvider::getUserMenuItems()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

Illuminate\Contracts\Container\BindingResolutionException

Target class [translator] does not exist.

at vendor/laravel/framework/src/Illuminate/Container/Container.php:914
910▕
911▕ try {
912▕ $reflector = new ReflectionClass($concrete);
913▕ } catch (ReflectionException $e) {
➜ 914▕ throw new BindingResolutionException("Target class [$concrete] does not exist.", 0, $e);
915▕ }
916▕
917▕ // If the type is not instantiable, the developer is attempting to resolve
918▕ // an abstract type such as an Interface or Abstract Class and there is

+9 vendor frames
10 app/Providers/Filament/AppPanelProvider.php:229

11 app/Providers/Filament/AppPanelProvider.php:84
App\Providers\Filament\AppPanelProvider::getUserMenuItems()

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
11 replies
FFilament
Created by StanProg on 8/9/2023 in #❓┊help
Nested Navigation Groups in v3
14 replies
FFilament
Created by StanProg on 8/7/2023 in #❓┊help
How to get currently logged user in AppPanelProvider?
In AppPanelProvider::panel() I have $user = Auth::user();, but the result is NULL i.e. it seems that the currently logged user is not available in this method. Is there a way to have access to it in this method?
10 replies
FFilament
Created by StanProg on 8/7/2023 in #❓┊help
Missing resources after upgrade to v3
I've upgraded Filament to v3, including upgrade of Livewire. I've managed to get at least some "view" after a bunch of fixes, but some resources seem to not be present and give 404 like: css/filament/support/support.css?v=3.0.7.0 css/filament/forms/forms.css?v=3.0.7.0 css/app/custom-stylesheet.css?v=3.0.7.0 js/filament/forms/forms.js?v=3.0.7.0 js/filament/notifications/notifications.js?v=3.0.7.0 js/filament/support/support.js?v=3.0.7.0 js/filament/support/async-alpine.js?v=3.0.7.0 js/filament/tables/tables.js?v=3.0.7.0 js/filament/filament/echo.js?v=3.0.7.0 js/filament/filament/app.js?v=3.0.7.0 Do you have any idea should these be generated by some other "upgrade" script that I have to run?
4 replies