lukevi
lukevi
FFilament
Created by lukevi on 6/21/2024 in #❓┊help
Column URL - apply only to text, not the whole cell?
My users are a bit thrown off that in an otherwise clickable row, the whitespace in a URL column follows the URL, rather than the row-click behavior. In their defense, mousing over the text creates an underline as if only the text is the link. Perhaps if mousing over the whitespace also triggered the underline, the current behavior would be more intuitive. Can anybody suggest how to accomplish either? Thanks in advance.
8 replies
FFilament
Created by lukevi on 3/6/2024 in #❓┊help
testing repeater / fillForm / fill default item
Hi - I'm just getting started writing tests for my app with Pest. My first and most high-traffic resource has a repeater on it, which shows 1 instance by default. When I run fillForm() and pass in one instance of a repeater record, I end up with 2 instances. Thanks in advance for any advice!
$create = livewire(QuoteRequestResource\Pages\CreateQuoteRequest::class)
->fillForm([
'client_id' => 10,
'policies' => [
$policy
]
])
->call('create');
// ->assertHasNoFormErrors(); //fails
$create = livewire(QuoteRequestResource\Pages\CreateQuoteRequest::class)
->fillForm([
'client_id' => 10,
'policies' => [
$policy
]
])
->call('create');
// ->assertHasNoFormErrors(); //fails
the form has this repeater:
Forms\Components\Repeater::make('policies')
->relationship()
->schema([
Forms\Components\Hidden::make('partner_id')
->default(Filament::getTenant()->id),
Forms\Components\Hidden::make('client_id'),
Forms\Components\Select::make('policy_type_id')
->label('Policy Type')
->columnSpan(3)
->options(PolicyType::all()->pluck('name', 'id'))
->required(),
//...
])
->addActionLabel('Add Another Policy')
->defaultItems(1)
Forms\Components\Repeater::make('policies')
->relationship()
->schema([
Forms\Components\Hidden::make('partner_id')
->default(Filament::getTenant()->id),
Forms\Components\Hidden::make('client_id'),
Forms\Components\Select::make('policy_type_id')
->label('Policy Type')
->columnSpan(3)
->options(PolicyType::all()->pluck('name', 'id'))
->required(),
//...
])
->addActionLabel('Add Another Policy')
->defaultItems(1)
the testing db ends up with 2 policy instances
// validation issue is w a 2nd policy inst - why is it there?
dd(QuoteRequest::with('policies')->get()->toArray());
// validation issue is w a 2nd policy inst - why is it there?
dd(QuoteRequest::with('policies')->get()->toArray());
1 replies
FFilament
Created by lukevi on 8/31/2023 in #❓┊help
Set all column titles to headline()
Hi- I have lots of two-word column names, and I'd prefer table columns to use headline case, eg "Created At" rather than the default which winds up as "Created at". I know I could set an explicitly-cased title for each one, but I would much prefer that as the default. Is there any place I can override getLabel() for my project? This tweak solves it:
public function getLabel(): string | Htmlable
{
$label = $this->evaluate($this->label) ?? (string) str($this->getName())
->beforeLast('.')
->afterLast('.')
->headline();
// ->kebab()
// ->replace(['-', '_'], ' ')
// ->ucfirst();
public function getLabel(): string | Htmlable
{
$label = $this->evaluate($this->label) ?? (string) str($this->getName())
->beforeLast('.')
->afterLast('.')
->headline();
// ->kebab()
// ->replace(['-', '_'], ' ')
// ->ucfirst();
7 replies
FFilament
Created by lukevi on 8/21/2023 in #❓┊help
renderHook scopes don't work
Hi- I'm new to this so probably doing it wrong: in panel():
->renderHook(
'panels::content.end',
fn (array $scopes): View => view('extra-stuff', ['scopes' => $scopes]),
// scopes: [
// \App\Filament\Resources\ClientResource::class,
// \App\Filament\Resources\ClientResource\Pages\ListClients::class
// ]
);
->renderHook(
'panels::content.end',
fn (array $scopes): View => view('extra-stuff', ['scopes' => $scopes]),
// scopes: [
// \App\Filament\Resources\ClientResource::class,
// \App\Filament\Resources\ClientResource\Pages\ListClients::class
// ]
);
with the scopes uncommented, I would expect to see my extra stuff under client list/view/edit etc, right? if I comment out the scopes, my content appears, but otherwise it does not. I'm freshly updated on v3.0.30 after trying this for a while on .27. TIA for any advice! update to add: when I @dump($scopes) in my view, it's an empty array every time.
8 replies