alexanderkroneis
alexanderkroneis
FFilament
Created by alexanderkroneis on 4/24/2024 in #❓┊help
Characters are removed on browser auto-fill
Hi, when I use the auto fill function of my browser the input field removes characters (see the video).
Forms\Components\TextInput::make('title')
->label(__('Titel'))
->helperText(__('Dieser Titel wird auf der Website angezeigt um das Produkt zu vermarkten.'))
->required()
->live(debounce: 500)
->afterStateUpdated(function (Forms\Get $get, Forms\Set $set, ?string $old, ?string $state) {
if (($get('slug') ?? '') !== Str::slug($old)) {
return;
}

$set('slug', Str::slug($state));
}),
Forms\Components\TextInput::make('title')
->label(__('Titel'))
->helperText(__('Dieser Titel wird auf der Website angezeigt um das Produkt zu vermarkten.'))
->required()
->live(debounce: 500)
->afterStateUpdated(function (Forms\Get $get, Forms\Set $set, ?string $old, ?string $state) {
if (($get('slug') ?? '') !== Str::slug($old)) {
return;
}

$set('slug', Str::slug($state));
}),
5 replies
FFilament
Created by alexanderkroneis on 12/6/2023 in #❓┊help
Use Accessor in Global Search
Hi, the documentation says that we can use an accessor to feed the global search (see https://filamentphp.com/docs/3.x/panels/resources/getting-started#record-titles). I just tried that by using name as $recordTitleAttribute and it queries the table and does not use the accessor. Is there something missing in the docs or is there a bug?
class CompanyResource extends Resource
{
protected static ?string $model = Company::class;

protected static ?string $recordTitleAttribute = 'name';
class CompanyResource extends Resource
{
protected static ?string $model = Company::class;

protected static ?string $recordTitleAttribute = 'name';
12 replies
FFilament
Created by alexanderkroneis on 11/5/2023 in #❓┊help
Child Relationship of Tenant Model
Hi, I am currently working on a simple tenancy application. The tenant has some relationships, e.g. customers or users. The Customer model has a relation to projects. I can't figure out, how to implement this child-relationship to Tenant. That's my current approach
class ProjectResource extends Resource
{
protected static ?string $model = Project::class;

protected static ?string $tenantOwnershipRelationshipName = 'customer';
protected static ?string $tenantRelationshipName = 'customer';
class ProjectResource extends Resource
{
protected static ?string $model = Project::class;

protected static ?string $tenantOwnershipRelationshipName = 'customer';
protected static ?string $tenantRelationshipName = 'customer';
which gives me the following error:
The model [App\Models\Team] does not have a relationship named [customer]. You can change the relationship being used by setting it as the [$tenantRelationshipName] static property on the [App\Filament\App\Resources\ProjectResource] resource class.
The model [App\Models\Team] does not have a relationship named [customer]. You can change the relationship being used by setting it as the [$tenantRelationshipName] static property on the [App\Filament\App\Resources\ProjectResource] resource class.
Which is a valid error. But how can I instruct Filament to go into the customer model and look for the tenant over there?
2 replies
FFilament
Created by alexanderkroneis on 10/30/2023 in #❓┊help
Different UI for Create/Edit and View?
Hi, this is more of a discussion than asking for specific help since I'm wondering: Can the create/edit form be different to the view? 🤔 E.g. a wizard for create/edit and a total different UI for the view?
5 replies
FFilament
Created by alexanderkroneis on 10/24/2023 in #❓┊help
Can't resolve Record parameter in Test
Hi, I'm currently adding tests to my application and wanted to test if a user can edit a agency when the permission is given. Somehow I always get an exception:
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class Filament\Resources\Pages\EditRecord (View: /var/www/html/storage/framework/views/a168b0ebcff266df6b662fc4b6d06e88.blade.php)
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class Filament\Resources\Pages\EditRecord (View: /var/www/html/storage/framework/views/a168b0ebcff266df6b662fc4b6d06e88.blade.php)
actingAs($user)
->get(AgencyResource::getUrl('edit', ['record' => $agency]))
->assertSuccessful();
actingAs($user)
->get(AgencyResource::getUrl('edit', ['record' => $agency]))
->assertSuccessful();
2 replies
FFilament
Created by alexanderkroneis on 10/19/2023 in #❓┊help
Can we summarize using Sushi?
Hi, can we summarize a table when using Sushi? When I add
<?php

Tables\Columns\TextColumn::make('revenue')
->label(__('Umsatz'))
->money('EUR')
->sortable()
->toggleable()
->summarize([
Tables\Columns\Summarizers\Sum::make(),
]),
<?php

Tables\Columns\TextColumn::make('revenue')
->label(__('Umsatz'))
->money('EUR')
->sortable()
->toggleable()
->summarize([
Tables\Columns\Summarizers\Sum::make(),
]),
I get this error: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '":memory:"."booking_statistics") as booking_statistics' at line 1
4 replies
FFilament
Created by alexanderkroneis on 10/19/2023 in #❓┊help
Different calendars with FullCalendar by Saade
Hi, I'd like to use different calendars in my application and don't know how since the configuration is in the panel configuration. 🤔
5 replies
FFilament
Created by alexanderkroneis on 10/19/2023 in #❓┊help
Group Records by Name and Month
Hi, I have records of Booking which should be grouped by product.contract.hotel.name (which is working fine) and additonally grouped by the month of Booking.starts_at. It should be grouped like:
Hotel Paradise
January 100,00 € 25% 42,95 €
February 145,00 € 29% 47,25 €
...

Hotel Seaside
...
Hotel Paradise
January 100,00 € 25% 42,95 €
February 145,00 € 29% 47,25 €
...

Hotel Seaside
...
2 replies
FFilament
Created by alexanderkroneis on 10/19/2023 in #❓┊help
Test different panels
Hi, how can I test different panels e.g.
test('can create a user', function () {
$user = User::factory()->make();

Livewire::test(UserResource\Pages\CreateUser::class)
->fillForm([
'name' => $user->name,
'email' => $user->email,
])
->call('create')
->assertHasNoFormErrors();

$this->assertDatabaseHas(User::class, [
'name' => $user->name,
'email' => $user->email,
]);
});
test('can create a user', function () {
$user = User::factory()->make();

Livewire::test(UserResource\Pages\CreateUser::class)
->fillForm([
'name' => $user->name,
'email' => $user->email,
])
->call('create')
->assertHasNoFormErrors();

$this->assertDatabaseHas(User::class, [
'name' => $user->name,
'email' => $user->email,
]);
});
If I run php artisan test I get this error:
Route [filament.admin.resources.users.index] not defined. (View: /var/www/html/vendor/filament/filament/resources/views/components/page/index.blade.php) (View: /var/www/html/vendor/filament/filament/resources/views/components/page/index.blade.php) (View: /var/www/html/vendor/filament/filament/resources/views/components/page/index.blade.php)
Route [filament.admin.resources.users.index] not defined. (View: /var/www/html/vendor/filament/filament/resources/views/components/page/index.blade.php) (View: /var/www/html/vendor/filament/filament/resources/views/components/page/index.blade.php) (View: /var/www/html/vendor/filament/filament/resources/views/components/page/index.blade.php)
9 replies
FFilament
Created by alexanderkroneis on 10/18/2023 in #❓┊help
How to connect multiple models of the same type?
Hi, I'm trying to implement a family structure in my application. I have n Customers who are related to each other (Siblings, Parents, all that stuff). I'm thinking about adding a family_id to customers table and creating an own families table. What would the best approach in Filament be?
5 replies
FFilament
Created by alexanderkroneis on 10/17/2023 in #❓┊help
Custom Data in Table
How do I populate a Filament table in a Livewire component with custom data? I want to generate statistical data and I'd need sums / averages from different places.
5 replies
FFilament
Created by alexanderkroneis on 10/16/2023 in #❓┊help
Undefined array key "large_url"
Hi, I just added Curator to my application and receiving this exception: https://flareapp.io/share/q5YwLzoP
5 replies
FFilament
Created by alexanderkroneis on 10/13/2023 in #❓┊help
Curator Plugin: What's required for a n:m-migration?
Hi, I just installed the Curator Plugin of @awcodes and I'm wondering what's the schema of a many-to-many migration? I can't find it within the docs and I am receiving the 3rd exception now, that a column is missing.
20 replies
FFilament
Created by alexanderkroneis on 10/12/2023 in #❓┊help
Dispatching Event after Action
Hi guys, I added a PriceAssistantAction class to my application which is used at a specific tab in my ContractResource while editing a contract. The action itself is working perfectly fine, I just noticed one issue: When I call $livewire->dispatch('$refresh') in after(), the application does not refresh the user interface.
57 replies
FFilament
Created by alexanderkroneis on 10/11/2023 in #❓┊help
Summarized Table Rows
No description
13 replies
FFilament
Created by alexanderkroneis on 10/10/2023 in #❓┊help
Conditional Select Field
Hi, a couple Select fields should be populated and/or disabled based on other fields in my application. E.g. I only want to display rooms, which does not have been associated to a season yet.
Select::make('seasons')
...
->live(),

Select::make('rooms')
...
->options(fn (Contract $record, Get $get) => $record->rooms()->whereDoesntHave(...))
Select::make('seasons')
...
->live(),

Select::make('rooms')
...
->options(fn (Contract $record, Get $get) => $record->rooms()->whereDoesntHave(...))
The select field is not repopulated, any ideas?
3 replies
FFilament
Created by alexanderkroneis on 10/10/2023 in #❓┊help
Using Select with a BelongsToMany relation
Hi, I recognised a weird issue in an appliation of mine. I am using a Select component to assign Rooms to a Contract. They are stored in a contract_room table since it's a many-to-many relationship. When we take a look into the code, it seems like n:m is supported by Select.
56 replies
FFilament
Created by alexanderkroneis on 10/5/2023 in #❓┊help
Move Relationship Manager into a Tab
No description
11 replies
FFilament
Created by alexanderkroneis on 9/29/2023 in #❓┊help
Billing redirects after subscribing
Hi, I added Spark to my Filament application and it seems like the URL is not correct. I added multi tenancy to my App Panel, this is also where I added Spark. I'd expect the URL to be something like http://localhost/app/billing, but it's localhost/billing and after subscribing I get redirected to http://localhost/billing?checkout=subscription_started which returns 404. How do I prevent the 404 and where can I define that the billing route should be in app.
5 replies
FFilament
Created by alexanderkroneis on 9/18/2023 in #❓┊help
Current state in Select field
Hi, I am trying to disable a field while another field is not set.
Forms\Components\Select::make('room_id')
->label(__('Zimmer'))
->relationship('room')
->required()
->searchable()
->preload()
->disabled(fn(array $state) => ...),
Forms\Components\Select::make('room_id')
->label(__('Zimmer'))
->relationship('room')
->required()
->searchable()
->preload()
->disabled(fn(array $state) => ...),
but array $state is not working since it's injected with null and that's wrong. 😅
4 replies