Jpac14
Jpac14
Explore posts from servers
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
For each one, okay. Thanks. I though there would be an easier way.
12 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
I have tried that, but I want the text input to update when I change the toggles or the select?
12 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
It is apart of the panel builder inside a header action, with a modal form?
12 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
Or is afterStateUpdate my best bet?
12 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
Could I even link it in with extra attributes and use alpinejs to update it?
12 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
That I can just have a function on the url to get the state when it's updated
12 replies
FFilament
Created by Jpac14 on 12/31/2024 in #❓┊help
Update text input dynamic based off other important
But I don't want to use afterStateUpdate on each input is there a better way
12 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
If you have any other ideas let me know. Thanks, Jpac14
10 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
Hi Ava, I tried this but it didn't work. Maybe FileUpload doesn't work very well with dynamically disabling. Not sure if this will help, but here is the code for TenantFIleUpload it is almost identical to FileUpload
class TenantFileUpload extends FileUpload
{
protected function setUp(): void
{
parent::setUp();

// Override file retrieval logic to use tenant_asset
$this->getUploadedFileUsing(static function (TenantFileUpload $component, string $file, string | array | null $storedFileNames): ?array {
try {
$url = tenant_asset($file); // Use tenant_asset to resolve the URL
} catch (Throwable $exception) {
return null;
}

return [
'name' => ($component->isMultiple() ? ($storedFileNames[$file] ?? null) : $storedFileNames) ?? basename($file),
'size' => $component->getDisk()->size($file),
'type' => $component->getDisk()->mimeType($file),
'url' => $url,
];
});
}
}
class TenantFileUpload extends FileUpload
{
protected function setUp(): void
{
parent::setUp();

// Override file retrieval logic to use tenant_asset
$this->getUploadedFileUsing(static function (TenantFileUpload $component, string $file, string | array | null $storedFileNames): ?array {
try {
$url = tenant_asset($file); // Use tenant_asset to resolve the URL
} catch (Throwable $exception) {
return null;
}

return [
'name' => ($component->isMultiple() ? ($storedFileNames[$file] ?? null) : $storedFileNames) ?? basename($file),
'size' => $component->getDisk()->size($file),
'type' => $component->getDisk()->mimeType($file),
'url' => $url,
];
});
}
}
10 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
Bump!
10 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
Any help appreciated thanks
10 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
It disables a text input but when I link it to a file input it fails to disable it.
10 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
If someone could try reproduce this that would be great.
10 replies
FFilament
Created by Jpac14 on 12/29/2024 in #❓┊help
Trying to dynamically disable file input, when checkbox is checked
use InteractsWithForms;
use WithFileUploads;

protected static ?string $navigationIcon = 'heroicon-o-paint-brush';

protected static ?string $navigationGroup = 'Settings';

protected static string $view = 'filament.tenant.pages.branding';

public ?array $data = [];

public function mount(): void
{
$this->form->fill([
'name' => tenant('name'),
'primary_color' => tenant('primary_color'),
'logo' => tenant('logo'),
'favicon' => tenant('favicon'),
]);
}

public function form(Form $form): Form
{
return $form->schema(BrandingForm::schema())->statePath('data');
}

public function submit()
{
$this->validate();

dd($this->data);

$logoUrl = $this->processImage($this->data['logo'], 'logos');
$faviconUrl = $this->processImage($this->data['favicon'], 'favicons');

tenant()->update([
'name' => $this->data['name'],
'primary_color' => $this->data['primary_color'],
'logo' => $logoUrl,
'favicon' => $faviconUrl,
]);

Notification::make()
->title('Branding updated')
->success()
->send();

$this->dispatch('reload');
}
use InteractsWithForms;
use WithFileUploads;

protected static ?string $navigationIcon = 'heroicon-o-paint-brush';

protected static ?string $navigationGroup = 'Settings';

protected static string $view = 'filament.tenant.pages.branding';

public ?array $data = [];

public function mount(): void
{
$this->form->fill([
'name' => tenant('name'),
'primary_color' => tenant('primary_color'),
'logo' => tenant('logo'),
'favicon' => tenant('favicon'),
]);
}

public function form(Form $form): Form
{
return $form->schema(BrandingForm::schema())->statePath('data');
}

public function submit()
{
$this->validate();

dd($this->data);

$logoUrl = $this->processImage($this->data['logo'], 'logos');
$faviconUrl = $this->processImage($this->data['favicon'], 'favicons');

tenant()->update([
'name' => $this->data['name'],
'primary_color' => $this->data['primary_color'],
'logo' => $logoUrl,
'favicon' => $faviconUrl,
]);

Notification::make()
->title('Branding updated')
->success()
->send();

$this->dispatch('reload');
}
10 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
fixed 👍 use custom fileupload extend
9 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
Any ideas on how to fix this situation
9 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
if I try tenant('logo') it requests the wrong url going straight to localhost
9 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
but when I fill this in, it fails to load the image.
9 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
9 replies
FFilament
Created by Jpac14 on 12/28/2024 in #❓┊help
Editing image in custom page
Now when I save the image, the url to retrive it is given by tenant_asset(tenant('logo'))
9 replies