morty
morty
FFilament
Created by morty on 9/10/2024 in #❓┊help
Tailwind CSS: Unhandled exception: require() of ES Module
No description
4 replies
FFilament
Created by morty on 9/4/2024 in #❓┊help
What does `->evaluate()` do?
I see this all over the code base but not really understanding entirely what it's doing. Can someone explain?
5 replies
FFilament
Created by morty on 8/29/2024 in #❓┊help
Added colour not working
No description
8 replies
FFilament
Created by morty on 8/28/2024 in #❓┊help
Make field read-only but also styled as if it was disabled?
Is this possible? ->readOnly() is what I want functionally but ->disabled() is what I want visually. If I use ->disabled() then the field is not submitted with the form, but if I use ->readOnly() then the field is still focusable and looks active.
6 replies
FFilament
Created by morty on 8/27/2024 in #❓┊help
If I want to extend a form component to my own class, where do I do this?
I guess what I'm asking is where in the app structure would you do this?
5 replies
FFilament
Created by morty on 8/24/2024 in #❓┊help
AttachAction select different relationship?
I have two models with a BelongsToMany relationship: Account and AccountCollection. I also have an AccountsRelationManager on an AccountCollectionResource. I have a relationship setup on the Account model called collections() rather than the Laravel naming convention of accountCollections(). When I try to attach an account on the relation manager, I get the following error:
Call to undefined method App\Models\Crm\Account::accountCollections()
It seems the AttachAction is looking for a relationship that doesn't exist. How can I fix this without renaming my relationship? Is there an option on the AttachAction I can use?
3 replies
FFilament
Created by morty on 8/22/2024 in #❓┊help
Storing file size and mime type from uploaded file.
I understand that I should be using the afterStateUpdated method, but how can I inject these two properties from the uploaded file into the $data array? Am I supposed to use a hidden form field or is there a better way?
10 replies
FFilament
Created by morty on 8/21/2024 in #❓┊help
Spatie Media Library plugin - How to get it to work inside a ManageRelatedRecords page?
I have the Spatie Media Library plugin installed and working in a normal resource, but if I try to use it in a ManageRelatedRecords page, I get SQL errors. Wondering how I can get it to work?
SQLSTATE[23000]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Cannot insert the value NULL into column 'collection_name', table 'prism_test.dbo.media'; column does not allow nulls. INSERT fails. (Connection: sqlsrv, SQL: insert into [media] ([model_id], [model_type], [uuid], [order_column], [updated_at], [created_at]) values (1026, App\Models\Crm\Account, 16cbffaf-e484-46f2-9f56-41d4b00a9910, 1, 2024-08-21 17:48:24.995, 2024-08-21 17:48:24.995))
class ManageAccountMedia extends ManageRelatedRecords
{
protected static string $resource = AccountResource::class;

protected static string $relationship = 'media';

protected static ?string $navigationLabel = 'Media';

public function form(Form $form): Form
{
return $form
->schema([
SpatieMediaLibraryFileUpload::make('test'),
])
->columns(1);
}
}
class ManageAccountMedia extends ManageRelatedRecords
{
protected static string $resource = AccountResource::class;

protected static string $relationship = 'media';

protected static ?string $navigationLabel = 'Media';

public function form(Form $form): Form
{
return $form
->schema([
SpatieMediaLibraryFileUpload::make('test'),
])
->columns(1);
}
}
30 replies
FFilament
Created by morty on 8/16/2024 in #❓┊help
Is there a more succinct way of retrieving a count of a resource inside a `ManageRelatedRecords`?
I'm trying to add a navigation badge to a record sub navigation item. Inside my ManageRelatedRecords page, I'm doing the following:
public static function getNavigationBadge(): ?string
{
return self::getResource()::getModel()::where(
'name_and_address_id',
request()->route()->parameter('record')
)
->firstOrFail()
->notes()
->count();
}
public static function getNavigationBadge(): ?string
{
return self::getResource()::getModel()::where(
'name_and_address_id',
request()->route()->parameter('record')
)
->firstOrFail()
->notes()
->count();
}
I'm wondering if there is a way to get the parent record without doing the request()->route()->parameter('record') search?
9 replies
FFilament
Created by morty on 8/16/2024 in #❓┊help
What's your rule of thumb on when to use `heroicon-o` vs `heroicon-m`?
Currently I have a mix of these throughout my app and I'd like to standardize on when to use which. I'm just wondering what you all do?
8 replies
FFilament
Created by morty on 8/15/2024 in #❓┊help
Infolist table repeater or key-value from a relationship?
Hi, Is there a way to display a list of key-values from a has many relationship in an infolist? If not, is there a way to display a table of this relationship? For example, If my infolist was about an Author model, is there an infolist entry I can use to display a list of all the author's books from a related Book model?
4 replies
FFilament
Created by morty on 8/14/2024 in #❓┊help
SelectFilter unique/distinct relationship value
I have a table of tickets that belong to a location. Some locations are in the same city. How can I use a SelectFilter to get a unique list of cities from the locations table to filter the tickets? This is my code so far:
Tables\Filters\SelectFilter::make('location.city')
->label('City')
->placeholder('All')
->relationship('location', 'city')
->multiple()
->preload()
->searchable(),
Tables\Filters\SelectFilter::make('location.city')
->label('City')
->placeholder('All')
->relationship('location', 'city')
->multiple()
->preload()
->searchable(),
But this gives me a list of duplicated cities. I tried something like the following but unsuccessfully:
->relationship(
'location',
'city',
fn (Builder $query): Builder => $query->distinct())
->relationship(
'location',
'city',
fn (Builder $query): Builder => $query->distinct())
Not sure how to achieve this?
7 replies
FFilament
Created by morty on 8/1/2024 in #❓┊help
Typed property Filament\Tables\Filters\BaseFilter::$table must not be accessed before initialization
No description
3 replies
FFilament
Created by morty on 7/9/2024 in #❓┊help
Widget graphs change color when browser is resized
No description
2 replies
FFilament
Created by morty on 4/29/2024 in #❓┊help
Struggling on the simplest thing :( - How do I make a table row clickable to a modal view page?
I have a resource with a modal view page. That works fine. However, I can't seem to figure out how to make the clickable table row open this modal instead of the edit page. Can someone help please?
8 replies
FFilament
Created by morty on 4/16/2024 in #❓┊help
Regression in v3.2.67 - `foreach() argument must be of type array|object, null given`
I really don't want to create a reproduction repo for a GitHub issue. Is anyone else experiencing this when attaching a related record inside a relation manager using a belongsToMany relationship?
5 replies
FFilament
Created by morty on 4/16/2024 in #❓┊help
Can I align header actions with the heading and not the entire heading + subheading?
No description
3 replies
FFilament
Created by morty on 4/10/2024 in #❓┊help
Layout question - Can I put a form beside a table horizontally?
No description
6 replies
FFilament
Created by morty on 4/1/2024 in #❓┊help
Possible bug with exists rule on select multiple form components?
No description
1 replies
FFilament
Created by morty on 3/28/2024 in #❓┊help
Anyone using SPA mode get these console warnings?
No description
1 replies