GeRaged | Niklas
GeRaged | Niklas
FFilament
Created by GeRaged | Niklas on 11/17/2023 in #❓┊help
Spatie Roles Permissions
How can I make a resource only accessible for a specific role?
7 replies
FFilament
Created by GeRaged | Niklas on 10/27/2023 in #❓┊help
How to preselect a CheckboxList
Hey, how is it possible to preselect some values on a CheckboxList I already tried the ->default([{"10":"Test"}]) but this does not work. This is the complete code
Section::make('Attribute')
->schema(
self::getAttributeData(Resort::class)
->map(fn($attributes, $group) =>
CheckboxList::make($group)
->statePath('attributes')
->options(fn () => $attributes)
->default(fn (Resort $record) => $record->attributes()->pluck('name', 'id'))
)->toArray()
)
->columns(3)
Section::make('Attribute')
->schema(
self::getAttributeData(Resort::class)
->map(fn($attributes, $group) =>
CheckboxList::make($group)
->statePath('attributes')
->options(fn () => $attributes)
->default(fn (Resort $record) => $record->attributes()->pluck('name', 'id'))
)->toArray()
)
->columns(3)
2 replies
FFilament
Created by GeRaged | Niklas on 9/20/2023 in #❓┊help
Add messages for language
No description
1 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Enclose Textinput in form
Hey, how can I enclose an input to look like this
{
"form-1": {
"name": "Test"
}
}
{
"form-1": {
"name": "Test"
}
}
Default
{
"name": "Test"
}
{
"name": "Test"
}
3 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Remove Repeater when empty
Hey, I added a repeater and everytime I want to save it say, that the values cannot be null because it want to create the default empty entry in the repeater. How can I fix this?
5 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Check in form if edit or create
Hey, how can I check if the current form is an edit or create form?
3 replies
FFilament
Created by GeRaged | Niklas on 9/18/2023 in #❓┊help
Create link to edit model
Hey, where can I get the route to edit a model. I tried route('islands.edit') Route [islands.edit] not defined.
15 replies
FFilament
Created by GeRaged | Niklas on 9/15/2023 in #❓┊help
Update Checkboxes when select something
Hey, I have a Select with strings as options and checkboxes. When I select a specific string I want to filter out all checkboxes that are not compatible with the string. How Can I do this inside a form?
2 replies
FFilament
Created by GeRaged | Niklas on 9/15/2023 in #❓┊help
Use Icons
Hey I tried to use the icons linked in the documentation, but I got this error Svg by name "tabler-social" from set "default" not found. https://filamentphp.com/docs/3.x/support/icons https://blade-ui-kit.com/blade-icons/tabler-social
2 replies
FFilament
Created by GeRaged | Niklas on 9/14/2023 in #❓┊help
How to make own form component
Is there a detailed tutorial somewhere on how to make your own form components and then use them? I only found this (https://filamentphp.com/docs/3.x/tables/adding-a-table-to-a-livewire-component) but this is not detailed so much.
5 replies
FFilament
Created by GeRaged | Niklas on 9/13/2023 in #❓┊help
Installing filepond plugin for file upload
Hey, how can I install and addon of filepond for previewing pdf files on the file upload. I found the filepond-plugin-pdf-preview package but I dont know how to install this in filament.
6 replies
FFilament
Created by GeRaged | Niklas on 9/11/2023 in #❓┊help
Creating own form components like TextInput
Hey is there a complete and good structured tutorial on how to create an own form component like a rating or something else for the v3?
2 replies
FFilament
Created by GeRaged | Niklas on 9/11/2023 in #❓┊help
Save value from TextInput for sarch
Hey, is it possible to save a value typed in a TextInput (Form) to search something? I want to build a search and want to filter some relations. How can I do this?
11 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
Unable to call component method. Public method [setValue] not found on component
blade file
<button wire:click.prevent="setValue({{ $i }})">
<button wire:click.prevent="setValue({{ $i }})">
component
protected string $view = 'forms.components.star-rating';

protected int $value = 2;
protected int $maxStars = 5;

public function setValue(int $value): void
{
$this->value = $value;
}
protected string $view = 'forms.components.star-rating';

protected int $value = 2;
protected int $maxStars = 5;

public function setValue(int $value): void
{
$this->value = $value;
}
22 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
wire:click is submitting form.
Hey, I try to code a star rating but whenever I click on a star with my own method on it. It submits the form to create the model.
<div {{ $attributes }}>
@php
$id = $getId();
$isDisabled = $isDisabled();
@endphp
<div class="flex items-center gap-1">
@for ($i = 1; $i <= 5; $i++)
<button wire:click="setValue({{ $i }})">
@if ($i <= $getValue())
<svg class="w-8 h-8 text-yellow-300" style="color: rgb(253 224 71);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
<path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
</svg>
@else
<svg class="w-8 h-8" style="color: rgb(209 213 219);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
<path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
</svg>
@endif
</button>
@endfor
</div>
</div>
<div {{ $attributes }}>
@php
$id = $getId();
$isDisabled = $isDisabled();
@endphp
<div class="flex items-center gap-1">
@for ($i = 1; $i <= 5; $i++)
<button wire:click="setValue({{ $i }})">
@if ($i <= $getValue())
<svg class="w-8 h-8 text-yellow-300" style="color: rgb(253 224 71);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
<path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
</svg>
@else
<svg class="w-8 h-8" style="color: rgb(209 213 219);" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 22 20">
<path d="M20.924 7.625a1.523 1.523 0 0 0-1.238-1.044l-5.051-.734-2.259-4.577a1.534 1.534 0 0 0-2.752 0L7.365 5.847l-5.051.734A1.535 1.535 0 0 0 1.463 9.2l3.656 3.563-.863 5.031a1.532 1.532 0 0 0 2.226 1.616L11 17.033l4.518 2.375a1.534 1.534 0 0 0 2.226-1.617l-.863-5.03L20.537 9.2a1.523 1.523 0 0 0 .387-1.575Z"/>
</svg>
@endif
</button>
@endfor
</div>
</div>
3 replies
FFilament
Created by GeRaged | Niklas on 9/8/2023 in #❓┊help
Get Variable from Component in View
How can I access the $maxStars variable in my view?
namespace App\Forms\Components;

use Filament\Forms\Components\Component;

class StarRating extends Component
{
protected string $view = 'forms.components.star-rating';

protected int $maxStars = 5;

public static function make(): static
{
return app(static::class);
}
}
namespace App\Forms\Components;

use Filament\Forms\Components\Component;

class StarRating extends Component
{
protected string $view = 'forms.components.star-rating';

protected int $maxStars = 5;

public static function make(): static
{
return app(static::class);
}
}
3 replies
FFilament
Created by GeRaged | Niklas on 9/6/2023 in #❓┊help
mutateFormDataBefore for List
Is there something like a mutateFormDataBeforeShow method to edit the data before they are shown in the list?
12 replies
FFilament
Created by GeRaged | Niklas on 9/5/2023 in #❓┊help
Outsource Form
What is the best way to store forms that I use frequently? For example, I have a model in which I have to select another model and also have a "+" in the select to create a model for it. And then a model opens, which is then identical to the page where I could also create the model. There I would use quasi then 2 times the same form. So where would I store this most logical?
4 replies
FFilament
Created by GeRaged | Niklas on 9/4/2023 in #❓┊help
Save values of Select in variable
How can I save the values of a MultiSelect in a variable and use it in another Multiselect? I tried with $set but I dont know how to get the $get function inside an options function of a multiselect. After that I tried to save it via afterStateUpdated in a variable but I cant use $this inside an options function of a multiselect.
2 replies
FFilament
Created by GeRaged | Niklas on 9/4/2023 in #❓┊help
Morph CheckboxList
Hey, is it somehow possible to make a CheckboxList with a morphtable for example the table "model_has_attributes" -> attribute_id, model_type, model_id. How do I do something like this?
2 replies