TheNastyPasty
TheNastyPasty
FFilament
Created by TheNastyPasty on 6/7/2024 in #❓┊help
How to make a section horizontally scrollable?
Is it somehow possible to make a section horizontally scrollable? The reason is I want the layout to stay the same on smartphones, because otherwise it would be hard to read.
4 replies
FFilament
Created by TheNastyPasty on 6/7/2024 in #❓┊help
Only show label in a infolist
I want to show only a label in a repeatableentry without a value in a infolist. Is this somehow possible? Everything I tried didn't work. I need to align the labels with the values in the other repeatableentries.
Section::make()
->visible(true)
->schema([

RepeatableEntry::make('')
->label('Income')
->schema([
//Labels here
])
->contained(false)
->columnSpan(1),

RepeatableEntry::make('calculationProjectionsFirstYear')
->label('Year 1')
->schema([

TextEntry::make('gross_rent')
->hiddenLabel(true)
->money('AED', 100),

TextEntry::make('vacancy')
->hiddenLabel(true)
->money('AED', 100),

TextEntry::make('operating_income_total')
->hiddenLabel(true)
->money('AED', 100),
])
->contained(false)
->columnSpan(1),
Section::make()
->visible(true)
->schema([

RepeatableEntry::make('')
->label('Income')
->schema([
//Labels here
])
->contained(false)
->columnSpan(1),

RepeatableEntry::make('calculationProjectionsFirstYear')
->label('Year 1')
->schema([

TextEntry::make('gross_rent')
->hiddenLabel(true)
->money('AED', 100),

TextEntry::make('vacancy')
->hiddenLabel(true)
->money('AED', 100),

TextEntry::make('operating_income_total')
->hiddenLabel(true)
->money('AED', 100),
])
->contained(false)
->columnSpan(1),
16 replies
FFilament
Created by TheNastyPasty on 6/7/2024 in #❓┊help
Is it somehow possible to access the value of a different field?
I am trying to use the value of a different field as label for another one. I tried it like so:
RepeatableEntry::make('listing.operating_expenses')
->label('Operating Expenses')
->schema([
TextEntry::make('operating_expenses_name')
->hiddenLabel(true),

TextEntry::make('operating_expenses_cost')
->label(
fn($value) => $value['operating_expenses_name'] ?? 'Operating Expenses'
)
->inlineLabel(true)
->money('AED'),
])->contained(false),
RepeatableEntry::make('listing.operating_expenses')
->label('Operating Expenses')
->schema([
TextEntry::make('operating_expenses_name')
->hiddenLabel(true),

TextEntry::make('operating_expenses_cost')
->label(
fn($value) => $value['operating_expenses_name'] ?? 'Operating Expenses'
)
->inlineLabel(true)
->money('AED'),
])->contained(false),
But that seems not work. Help is much appreciated 🙂
10 replies
FFilament
Created by TheNastyPasty on 6/3/2024 in #❓┊help
Is it possible to have label and value beside each other?
What I mean is the following layout. Is there something built in? label -> value label -> value
4 replies
FFilament
Created by TheNastyPasty on 5/31/2024 in #❓┊help
Print array with Repeatableentry, how to?
No description
31 replies
FFilament
Created by TheNastyPasty on 5/22/2024 in #❓┊help
How to use authorization with actions in table
I am trying to use authorization with an action in my table but I have no idea how this should work.
Tables\Actions\Action::make(__('Download'))
->url(fn ($record) => route('filament.app.resources.qr-codes.download', $record->id))
->authorize('view', $this->record),
Tables\Actions\Action::make(__('Download'))
->url(fn ($record) => route('filament.app.resources.qr-codes.download', $record->id))
->authorize('view', $this->record),
The problem is I can't access the record
3 replies
FFilament
Created by TheNastyPasty on 5/19/2024 in #❓┊help
How to place language switcher outside of panel
I am trying to place the language switcher outside of my panel with
<livewire:filament-language-switch key='fls-outside-panels' />
<livewire:filament-language-switch key='fls-outside-panels' />
but that does not work. I am using https://github.com/bezhanSalleh/filament-language-switch Maybe someone knows how to do this?
36 replies
FFilament
Created by TheNastyPasty on 5/14/2024 in #❓┊help
How to call a whatsapp chat here?
I want to call a WhatsApp Chat in the ->actions() function with the data and clients I chose in my select. Is this somehow possible?
Action::make('send_whatsapp')
->label('Open Chat')
->icon('heroicon-o-chat-bubble-oval-left-ellipsis')
->form([
Select::make('clients')
->required()
->multiple()
->maxItems(10)
->exists(Client::class, 'id')
->preload()
->options(fn () => Client::select(DB::raw("CONCAT(firstname, ' ', lastname) AS full_name"), 'id')
->pluck('full_name', 'id')
->toArray())
->searchable()
->visible(fn (Whatsapp $whatsapp): bool => auth()->user()->can('update', $whatsapp)),
])
->action(function (Whatsapp $whatsapp, array $data) {
//here should be the action to open the whatsapp chat
}),
Action::make('send_whatsapp')
->label('Open Chat')
->icon('heroicon-o-chat-bubble-oval-left-ellipsis')
->form([
Select::make('clients')
->required()
->multiple()
->maxItems(10)
->exists(Client::class, 'id')
->preload()
->options(fn () => Client::select(DB::raw("CONCAT(firstname, ' ', lastname) AS full_name"), 'id')
->pluck('full_name', 'id')
->toArray())
->searchable()
->visible(fn (Whatsapp $whatsapp): bool => auth()->user()->can('update', $whatsapp)),
])
->action(function (Whatsapp $whatsapp, array $data) {
//here should be the action to open the whatsapp chat
}),
This is from the Docs Create your own link with a pre-filled message The pre-filled message will automatically appear in the text field of a chat. Use https://wa.me/whatsappphonenumber?text=urlencodedtext where whatsappphonenumber is a full phone number in international format and urlencodedtext is the URL-encoded pre-filled message. Example: https://wa.me/1XXXXXXXXXX?text=I'm%20interested%20in%20your%20car%20for%20sale To create a link with just a pre-filled message, use https://wa.me/?text=urlencodedtext Example: https://wa.me/?text=I'm%20inquiring%20about%20the%20apartment%20listing After clicking on the link, you’ll be shown a list of contacts you can send your message to.
7 replies
FFilament
Created by TheNastyPasty on 5/5/2024 in #❓┊help
Is it somehow possible to set the select value to null if not visible
I am trying to set the select value to null if the field is not visible in the form. What I have so far.
Toggle::make('customize_compounding')->label('Customize Compounding')->live()->columnSpan(['default' => 2]),
Group::make([
Select::make('compound_interval')
->enum(CompoundInterval::class)
->options(CompoundInterval::class)
->default(CompoundInterval::OneMonth->value)
->selectablePlaceholder(false)
->columnSpan(['default' => 2, 'sm' => 1]),
])->visible(fn (\Filament\Forms\Get $get): bool => $get('customize_compounding'))
Toggle::make('customize_compounding')->label('Customize Compounding')->live()->columnSpan(['default' => 2]),
Group::make([
Select::make('compound_interval')
->enum(CompoundInterval::class)
->options(CompoundInterval::class)
->default(CompoundInterval::OneMonth->value)
->selectablePlaceholder(false)
->columnSpan(['default' => 2, 'sm' => 1]),
])->visible(fn (\Filament\Forms\Get $get): bool => $get('customize_compounding'))
I don't know how to make that work. Someone has an idea?
8 replies
FFilament
Created by TheNastyPasty on 4/30/2024 in #❓┊help
$get inside loop null, outside loop it is not
I am trying to access the $get of a wizard multi step form, but I can't access it inside my loop. The strange thing outside of the loop it works. Event when I try to store the value of $get in a variable and I try to access it inside loop, no success.
foreach ($items as $item) {
dd($get('purchase_price'));
if ($item['cost_type'] === PurchasedCostsType::SetAmount->value) {
$sumInCents += round(floatval($item['cost']) * 100);
} elseif ($item['cost_type'] === PurchasedCostsType::Percentage->value) {
$sumInCents += floatval($get('purchase_price')) * round(floatval($item['percent']) / 100, precision: 4);
}
}
foreach ($items as $item) {
dd($get('purchase_price'));
if ($item['cost_type'] === PurchasedCostsType::SetAmount->value) {
$sumInCents += round(floatval($item['cost']) * 100);
} elseif ($item['cost_type'] === PurchasedCostsType::Percentage->value) {
$sumInCents += floatval($get('purchase_price')) * round(floatval($item['percent']) / 100, precision: 4);
}
}
6 replies
FFilament
Created by TheNastyPasty on 4/28/2024 in #❓┊help
numeric() function casts represents number with comma and not with dot
I don't know why but the numeric function casts somehow the dot notation to comma representation. Maybe someone knows why that is?
TextInput::make('armortizing_interest_rate')
->placeholder('e.g. 3')
->numeric()
->default(0)
->suffix('%')
->minValue(0)
->maxValue(100)
->nullable()
->columnSpan(['default' => 2, 'sm' => 1]),
TextInput::make('armortizing_interest_rate')
->placeholder('e.g. 3')
->numeric()
->default(0)
->suffix('%')
->minValue(0)
->maxValue(100)
->nullable()
->columnSpan(['default' => 2, 'sm' => 1]),
If I remove the numeric validation the number shows with a dot.
6 replies
FFilament
Created by TheNastyPasty on 4/25/2024 in #❓┊help
Is it necessary to do a check if the file belongs to the user?
Users in my app can upload images for different resources. I configured aws s3 to store files of my users. The question is now do I need to check if a certain file belongs to the user, so only a user who owns the file can view it. Or is this not necessary because I am using a s3 private bucket? This is what my fileupload looks like. The form is only visible to users to which the data belongs. I did that with policies.
FileUpload::make('files')
->multiple()
->visibility('private')
->disk('s3')
->directory('rentals')
->imageEditor()
->maxSize(10)
->maxFiles(10)
->openable()
->previewable(true)
->storeFileNamesIn('file_names')
->columnSpan(['default' => 2]),
FileUpload::make('files')
->multiple()
->visibility('private')
->disk('s3')
->directory('rentals')
->imageEditor()
->maxSize(10)
->maxFiles(10)
->openable()
->previewable(true)
->storeFileNamesIn('file_names')
->columnSpan(['default' => 2]),
10 replies
FFilament
Created by TheNastyPasty on 4/25/2024 in #❓┊help
Need to retrieve field from wizard step before
I need to get a field value from a step before in a wizard step form. I need this value for some live calculations. When I am dd($get) I get all the childcomponents, but I dont know how to access them. If I collapse all the things ($get) gives me I see
#childComponents: array:4 [▼
0 =>
Filament\Forms\Components\Wizard
\
Step {#2923 ▶}
1 =>
Filament\Forms\Components\Wizard
\
Step {#3087 ▶}
2 =>
Filament\Forms\Components\Wizard
\
Step {#2595}
3 =>
Filament\Forms\Components\Wizard
\
Step {#2369 ▶}
]
#childComponents: array:4 [▼
0 =>
Filament\Forms\Components\Wizard
\
Step {#2923 ▶}
1 =>
Filament\Forms\Components\Wizard
\
Step {#3087 ▶}
2 =>
Filament\Forms\Components\Wizard
\
Step {#2595}
3 =>
Filament\Forms\Components\Wizard
\
Step {#2369 ▶}
]
I need the Step with key = 1, but I really don't know how to access this step. Please someone could help.
3 replies
FFilament
Created by TheNastyPasty on 4/22/2024 in #❓┊help
Get values of a specific wizard step, which is not active
I am trying to get a value of a step before in my wizard step form, but I can't get it to work. If I dd($get) I can see its there but can't access it. Maybe someone can help
5 replies
FFilament
Created by TheNastyPasty on 4/18/2024 in #❓┊help
Attach file with original name to mail throws exception
Hello, I am trying for hours now to attach files to a mail, but without success. I am using the filament 3
->storeFileNamesIn('attachment_names')
->storeFileNamesIn('attachment_names')
function. Code which works
$attachments = [];

foreach ($this->template->attachments as $attachment) {
$attachments[] = Attachment::fromStorageDisk('local', $attachment);
}

return $attachments;
$attachments = [];

foreach ($this->template->attachments as $attachment) {
$attachments[] = Attachment::fromStorageDisk('local', $attachment);
}

return $attachments;
But I want to add the stored file names and that does not work. I get the following exception
Symfony\Component\Mime\Email::attachFromPath(): Argument #1 ($path) must be of type string, App\Mail\UserTemplate given
Symfony\Component\Mime\Email::attachFromPath(): Argument #1 ($path) must be of type string, App\Mail\UserTemplate given
public function attachments(): array
{
$attachments = [];
$attachment_names = $this->template->attachment_names;

foreach ($this->template->attachments as $attachment) {
$value = $attachment_names[$attachment] ?? null;
$attachments[] = $this->attachFromStorageDisk('local', $attachment, $value);
}

return $attachments;
}
public function attachments(): array
{
$attachments = [];
$attachment_names = $this->template->attachment_names;

foreach ($this->template->attachments as $attachment) {
$value = $attachment_names[$attachment] ?? null;
$attachments[] = $this->attachFromStorageDisk('local', $attachment, $value);
}

return $attachments;
}
Please someone can help Maybe there is a better way to attach files in filament 3 I dont know of.
5 replies
FFilament
Created by TheNastyPasty on 4/16/2024 in #❓┊help
Spark Billable Slug redirects to wrong url
I am using the Spark Billing Portal with Filament and everything is working so far, except the redirect url after a user has subscribed to a plan. I think it has something to do with the Billable Slugs in the Spark Documentation https://spark.laravel.com/docs/spark-stripe/configuration.html#billable-slugs. My url after payment is always
billing/user/app
billing/user/app
if I click on
return to app
return to app
. Maybe someone knows how to configure or change this.
1 replies
FFilament
Created by TheNastyPasty on 4/15/2024 in #❓┊help
Implement billing without multi tenancy
Hello, Is there a way to implement billing for my users. I want every user to subscribe to a package who registrates for the app. I have a spark licence already. The problem I can not find a tutorial on the internet about this topic. The filament docs only explain it for multi tenancy. Any help is appreciated
8 replies
FFilament
Created by TheNastyPasty on 4/14/2024 in #❓┊help
The Auth Features emails are not sent
Hello, I am using the Filament Authentication Feature and would like to send the corresponding emails. For example the password reset email or the verification email, but no matter what I try I can't get it to work. I don't get any error messages. Maybe someone could help me here, that would be very nice.
8 replies