Husky110
Husky110
FFilament
Created by Husky110 on 6/3/2024 in #❓┊help
Table-Widget-Problem (call to a member function table() on string)
Hi - I'm having trouble setting up a table-widget. I've created the widget via php artisan make:filament-widget ArticleStocksWidget --table, linked it to the ArticleResource and marked "The [console] panel". I've registered the widget within the resource and added it to the getHeaderWidgets in my "ViewArticle"-Page. When I try to display said widget, I get a blank space where it should be and then the display-error "call to a member function table() on string" pointing to my ->columns-method. My table-function looks like this:
public function table(Table $table): Table
{
return $table
->query(FrontendCacheReservedStocks::query())
->columns([
'fulfiller_id',
'stockcount',
]);
}
public function table(Table $table): Table
{
return $table
->query(FrontendCacheReservedStocks::query())
->columns([
'fulfiller_id',
'stockcount',
]);
}
FrontendCacheReservedStocks is a regular Model. Anyone have a clue on where to look here?
6 replies
FFilament
Created by Husky110 on 5/28/2024 in #❓┊help
Section Heading-Background-Color
Hi - Is it possible to change the background-color of a section-heading? I already tried the extraAttributes-way to add the section-danger-class (like it was in V2), but to no avail. Thanks
11 replies
FFilament
Created by Husky110 on 1/25/2024 in #❓┊help
Password reset-Mails are not beeing sent, eventho Mails are correctly configured
Hi - I'm having trouble getting password-resets to work. When I am in the form to enter the mailadress, I can input an e-mailadress and get the "We have emailed your password reset link."-notification, but I do not get the e-mail itself. I have already verified that sending mails itself works fine, since I have a form inside the app that sends mails and those E-Mails are beeing sent. So sending via Mail::to() works (including apropriate .env-variables). I also have veryfied that the App\Models\User-Model has the CanResetPassword and Notifyable-Trait which are required by Laravel. I did not add any other additional code or anything. Does any one have an idea where else to look for the problem?
4 replies
FFilament
Created by Husky110 on 1/18/2024 in #❓┊help
Navigation in groups with translated labels
No description
5 replies
FFilament
Created by Husky110 on 12/7/2023 in #❓┊help
Change Brand/Logo URL in V3
As the title states - how can I change the URL of the brandname/logo in the top-menu of filament v3? I found how to do it in V2, but not in V3.
8 replies
FFilament
Created by Husky110 on 11/24/2023 in #❓┊help
Rebuild Infolist
Hi - again I'm having a problem with my infolist. The background is this - I have a Model called "Checkpoint" that has a BelongsToMany-Relation to a Model called "Tag". Now I've added an action to remove a tag from a checkpoint. Problem is, that when I click on the action, the tag still persists on the page, until it is reloaded. Is there a way to reload that section or the infolist automatically? ->live() seems to be not available here. This is my code so far:
Section::make('Tags')->columns(3)->schema(function (){
$schema = [];
foreach ($this->record->tags->sortBy('tagname') as $tag){
$schema[] = TextEntry::make('tag_'.$tag->id)
->label(false)
->state($tag->tagname)
->suffixAction(
Action::make('remove_tag_'.$tag->id)
->icon('heroicon-o-x-mark')
->button()
->color('danger')
->label(false)
->tooltip('Remove Tag')
->action(function ($record) use ($tag){
$record->tags()->detach($tag->id);
})
);
}
return $schema;
})
Section::make('Tags')->columns(3)->schema(function (){
$schema = [];
foreach ($this->record->tags->sortBy('tagname') as $tag){
$schema[] = TextEntry::make('tag_'.$tag->id)
->label(false)
->state($tag->tagname)
->suffixAction(
Action::make('remove_tag_'.$tag->id)
->icon('heroicon-o-x-mark')
->button()
->color('danger')
->label(false)
->tooltip('Remove Tag')
->action(function ($record) use ($tag){
$record->tags()->detach($tag->id);
})
);
}
return $schema;
})
4 replies
FFilament
Created by Husky110 on 11/24/2023 in #❓┊help
Infolist - send data to Action
No description
8 replies
FFilament
Created by Husky110 on 11/21/2023 in #❓┊help
Wizard with depending steps in an action
Hi - I am trying to achieve a multi-step import. The steps should be: 1.) Input an URL x) Do some validation against an API 2.) Select Specifics 3.) Import I am struggeling on the x-part. It is possible that the user gives in a false URL (outside of scope, URL points to wrong datatype and whatnot). I have two questions here: A) Is it possible to keep the user in step 1 and display an error if he/she gives in false data? If so - how? B) Is there a way to build up the schema for step 2 dynamicly based on the validation done for question A? If so - how? Thanks. 🙂
4 replies
FFilament
Created by Husky110 on 9/1/2023 in #❓┊help
Modify Builder Delete-Action
Heyho, I'm having a Builder that builds blocks which then on save contain data for multiple models. Right now I face two problems: 1.) Is there a way to require a confirmation before the delete-action on that block is performed? 2.) How can I access the block that is about to be deleted, so I can perform the appropriate database-operations? Thanks in advance. 🙂
17 replies
FFilament
Created by Husky110 on 8/21/2023 in #❓┊help
Displaying a modal after action has been performed
Hi - I want to create a table action (like add it on each row) where a user clicks on a button, it performs an action (connection-check in this case) which returns either true or false. Afterwards I want to see a modal with either "success" or "failure". Now from what I get so far, I can create modals BEFORE an action has been performed (like confirmation modals or form-modals), but how do I do that AFTERWARDS? I could do the workarround by opening a modal, adding a button and update said modal, but that is not elegant enough for me. Is there a way to do it like "click button" -> "perform action" -> "show modal with content concering the action-result"? Thanks in advance. 🙂
23 replies
FFilament
Created by Husky110 on 8/11/2023 in #❓┊help
Question about security and registering new users
Hi there. My question is this: As far as I understand it, all Filament-Pages and -Resources are behind the "auth"->guardian and the canAccessFilament-function is called when a page or resource is accessed. Right? Right now I wanna do 2 things: 1.) I wanna add an "active"-column to my user-table. Is it enough to add return $this->active to said function to block all non-active users from entering? (Filament IS my frontend, so there is nothing else to be accessed.) If anyone has an idea on how to do this non-Filament-related: Please share! I could only find solutiuons that use Breeze as a package, but not Filament. 2.) On my old frontend, I have a system in place to register new users, where an existing user enters an e-mailadress which then receives a token, that is beeing used as a parameter in a url. How can I adapt that to filament? Like making the page accessable even without logging in and checking the parameter?
53 replies
FFilament
Created by Husky110 on 7/28/2023 in #❓┊help
Selfupdating / On-The-Fly / Dynamic Modal Form on Resources (Tutorial)
Hey - so this is a follow-up to #Selfupdating Modal-Form and an attempt to better state the problem and provide the found solution for future use. The problem:
Let's say you have to create an Action on a Resource (table) but the required form-entries (like which Inputs are required, which selects, or whatnot) depend on the record or a relation on the record you are working on. (I'm using the EditAction for this, but this should work on any other action as well!)
In my scenario the form-content relied on a model called "Config" and to add method to the madness, a secondary model we call "Parent". In here we call the model that the Resource displays just "Entity", to avoid confusion. So Entity belongs to Parent via parent_id. Config belongs to parent via parent_id. Entity and Config are linked via a BelongsToMany-relationship with a pivot-value called "value", which holds the set value. Now we have a Select on our form that set's the parent_id for Entity and we want the form to display all Config-models with the same parent_id as our select currently uses as selected value and update itself whenever the selected value (parent_id) changes.
The following thread will provide the solution to this, which has been found with extensive help of @pboivin and a pointer in the right direction by @smiliyas. Thank you guys. 🙂
11 replies
FFilament
Created by Husky110 on 7/27/2023 in #❓┊help
Empty model on mountUsing
Hi - I am building an EditAction on a Resource and want to use mountUsing(). I followed the docs at https://filamentphp.com/docs/2.x/tables/actions#filling-default-data and made my function look like this:
Tables\Actions\EditAction::make()
->mountUsing(function (Forms\ComponentContainer $form, DeliveryChannel $deliveryChannel){
$filling = [
'channelname' => $deliveryChannel->channelname,
'customer_id' => $deliveryChannel->customer_id,
];
foreach ($deliveryChannel->customerdeliverychannelconfigs as $deliveryChannelConfig){
$filling[$deliveryChannelConfig->customer_id.'-'.$deliveryChannelConfig->key] = $deliveryChannelConfig->pivot->value;
}
return $form->fill($filling);
}),
Tables\Actions\EditAction::make()
->mountUsing(function (Forms\ComponentContainer $form, DeliveryChannel $deliveryChannel){
$filling = [
'channelname' => $deliveryChannel->channelname,
'customer_id' => $deliveryChannel->customer_id,
];
foreach ($deliveryChannel->customerdeliverychannelconfigs as $deliveryChannelConfig){
$filling[$deliveryChannelConfig->customer_id.'-'.$deliveryChannelConfig->key] = $deliveryChannelConfig->pivot->value;
}
return $form->fill($filling);
}),
But the modal it not beeing filled up. The form-elements themselfs are there, but have no values. DeliveryChannel is the Model bound to the Resource. A dd($deliveryChannel) revealed that the function receives an empty model. Does anyone have an idea on how to get the actual model I've clicked on the table?
7 replies
FFilament
Created by Husky110 on 7/26/2023 in #❓┊help
Selfupdating Modal-Form
22 replies
FFilament
Created by Husky110 on 7/25/2023 in #❓┊help
Display Relationshipvalue in View-Form on Resource-Modal
Hi - Since Discord decides to bug out on the search-function and scrolling the result and I can't find it anywhere, could someone please point me in the right direction? I got a Resource and wanna do a quick view-action, so I build up the form()-method like this:
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('myrelation.worker')
->label('Queue'),
Forms\Components\TextInput::make('myrelation.jobkey')
->label('Job'),
Forms\Components\Textarea::make('message')
->label('Fehlernachricht'),
Forms\Components\Textarea::make('job_data')
->label('Payload'),
Forms\Components\Textarea::make('trace')
->label('Trace')
->columnSpan(2),

]);
}
public static function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('myrelation.worker')
->label('Queue'),
Forms\Components\TextInput::make('myrelation.jobkey')
->label('Job'),
Forms\Components\Textarea::make('message')
->label('Fehlernachricht'),
Forms\Components\Textarea::make('job_data')
->label('Payload'),
Forms\Components\Textarea::make('trace')
->label('Trace')
->columnSpan(2),

]);
}
The fields on the record itself work fine, but the RelationShip-Fields on "myrelation" are empty. I found how to fix that on selects, but not on TextInputs. How can I fill those fields with their respected values? (I don't think that I have a typo on the notions.)
8 replies
FFilament
Created by Husky110 on 7/12/2023 in #❓┊help
Using a custom component in a Form
Hi - I think I've overlooked something here. I am creating a livewire-component to show an overview, which is then polled every 10 seconds. So I made a new component via php artisan make:livewire mycomponentand now I wanna use that within getFormSchema() inside a section, but it does not have the usual ::make() function, which all FilamentComponents have. Do I have to define a make-function myself or just use some Trait?
38 replies
FFilament
Created by Husky110 on 7/8/2023 in #❓┊help
Auto-Enable Toggle
Hey - As the title suggests: I'm trying to auto-enable a toggle-button. I tried treating it like a checkbox via Toggle::make('MyToggle')->default(true) but to no avail. I tried to use 1 or "on" as states, still nothing. Anyone has an idea on how to acchieve this?
14 replies
FFilament
Created by Husky110 on 7/7/2023 in #❓┊help
Filtervalue in query
Hi - I want to create a select-filter where a user can filter any data that has not been updated within in the last 12, 24 or 48 hours, which then would modify the query like where('updated_at', '<=', Carbon::now()->subtractHours($x)); now I got as far that I would have to modify the query-function, but so far I've only seen it like fn($query) => $query->where('xyz', 'abc') how do I add the current filter value to that? Utilizing the whole formbuilder-component seems a bit overkill here. Is there an easy way?
10 replies
FFilament
Created by Husky110 on 7/5/2023 in #❓┊help
Navigation is off... (incorrect margins and paddings)
39 replies
FFilament
Created by Husky110 on 7/2/2023 in #❓┊help
ViewParameter not beeing parsed in Action::make (Solved: Dev-Error!)
Hey folks - I ain't sure if this is a bug or if I am not seeing something (again). Given I got the following blade-view: https://gist.github.com/Husky110/c80783ec21915de92e9f36ff6c017369 (Note - I'm using flowbite) And given I have the following function on my page:
protected function getActions(): array
{
return [
Action::make('documentation')
->view('components.my-components.general.documentation-drawer', [
'documentationHeadline' => 'MEEPERS',
'viewToRender' => 'components.mystuff.anotherviewpath'
])
];
}
protected function getActions(): array
{
return [
Action::make('documentation')
->view('components.my-components.general.documentation-drawer', [
'documentationHeadline' => 'MEEPERS',
'viewToRender' => 'components.mystuff.anotherviewpath'
])
];
}
I should have a top-drawer that echos $viewToRender -> instead I'm getting Undefined variable $viewToRender. Interestingly enough - $documentationHeadline is beeing parsed just fine and if I remove $viewToRender from my blade-file, it works just fine. If there is a typo - I don't see it. Can someone please investigate this - if there might be a general problem?
45 replies