F
Filament
Join the Filament server to ask questions!
Join ServerF
Filament
Join the community to ask questions about Filament and get answers from other members.
Join ServerCommunity questions
Channels
RenderHook bottom of the Menu
Hey,
Im was trying to put a logo in the bottom of the sidebar.
but the code above renders it just after the last menu item, not on the bottom...
any work around this? Thanks
Im was trying to put a logo in the bottom of the sidebar.
Filament::registerRenderHook(
'sidebar.end',
fn (): View => view('filament.logoIPT.logo'),
);
but the code above renders it just after the last menu item, not on the bottom...
any work around this? Thanks
Solution:
I think I used CSS and added margin to the bottom of the sidebar and positioned the element at the bottom of the container with a position absolute
Message Not Public
Sign In & Join Server To View
undefined variable $activeTab in listPage Class
I am getting a error undefined variable $activeTab on the list page
```<?php
namespace App\Filament\Resources\BookingResource\Pages;
use App\Filament\Resources\BookingResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Pages\ListRecords\Tab;
use Illuminate\Database\Eloquent\Builder;
class ListBookings extends ListRecords
{
//public ?string $activeTab = 'active';
protected static string $resource = BookingResource::class;
p...
```<?php
namespace App\Filament\Resources\BookingResource\Pages;
use App\Filament\Resources\BookingResource;
use Filament\Actions\CreateAction;
use Filament\Resources\Pages\ListRecords;
use Filament\Resources\Pages\ListRecords\Tab;
use Illuminate\Database\Eloquent\Builder;
class ListBookings extends ListRecords
{
//public ?string $activeTab = 'active';
protected static string $resource = BookingResource::class;
p...
Solution:
fixed in .58
Message Not Public
Sign In & Join Server To View
SelectFilter hidden()
So I have this SelectFilter that I want hidden based on $activeTab that is set by getTabs(). I have ```php
SelectFilter::make('status')
->label('Status')
->hidden(function () {
ray($this->activeTab)->label('status');
return in_array($this->activeTab, ['all', 'active', 'inactive']);
})
->options([
'Active' => 'Active',
'Prospect' => auth()->user()->isInternal() ? 'Prospect' : 'Draft',
'Inactive' => 'Inactive',
])->query(function (Builde...
SelectFilter::make('status')
->label('Status')
->hidden(function () {
ray($this->activeTab)->label('status');
return in_array($this->activeTab, ['all', 'active', 'inactive']);
})
->options([
'Active' => 'Active',
'Prospect' => auth()->user()->isInternal() ? 'Prospect' : 'Draft',
'Inactive' => 'Inactive',
])->query(function (Builde...
Solution:
@archilex this is working great. thanks!
->hidden(function () {
$tabsToHideFilter = ['active', 'inactive', 'draft'];
$shouldHideFilter = in_array($this->activeTab, $tabsToHideFilter);
if ($shouldHideFilter) {
$this->tableFilters['status'] = null;
}
return $shouldHideFilter;
})
public function updatedActiveTab(): void
{
unset($this->cachedForms['tableFiltersForm']);
$this->resetPage();
}
assertPageActionHidden testing helper gone?
Is the
assertPageActionHidden
testing helper gone?Solution:
Looks like it is now working with
assertActionHidden
formatStateUsing not called if value is null
Tables\Columns\TextColumn::make('cancelled_at')
->label('Cancelled')
->formatStateUsing(fn (?string $state) => $state ? 'Yes' : 'No')
->colors([
'success' => static fn (?string $state): bool => empty($state),
'danger' => static fn (?string $state): bool => !empty($state),
]),
This does echo "Yes" but if
cancelled_at
is null
it wont show "...Solution:
Use
getStateUsing()
insteadMessage Not Public
Sign In & Join Server To View
Full screen widget
Is it possible to toggle a widget (chart widget to be specific) to show in full screen? I haven't found anything about it.
I was first thinking of adding an action in the header of the widget, but that doesn't seem to be possible without making a custom widget. am i right?
I was first thinking of adding an action in the header of the widget, but that doesn't seem to be possible without making a custom widget. am i right?
Solution:
ahh, would be a custom widget as well
Message Not Public
Sign In & Join Server To View
Different app name for each panel
Filament uses the application name for in the title. Is this something that i can override to make this customizable for every panel?
Solution:
->brandName('')
?Message Not Public
Sign In & Join Server To View
How to test a custom action?
In v2 this used to work
but in V3 it gives
I changed callPageAction to runAction and now I'm getting
livewire(EditOrder::class, [
$order->getKey(),
])
->callPageAction('return');
but in V3 it gives
Method Illuminate\Http\Response::callPageAction does not exist.
I changed callPageAction to runAction and now I'm getting
Unable to call component method. Public method [return] not found on component
Solution:
Try
callAction()
Message Not Public
Sign In & Join Server To View
Make single row not clickable
Is there a way to make only one specific row not clickable?
Solution:
found out that it only seems to work when using
getTableRecordUrlUsing()
functionSelecting only a year
Does Filament's datepicker offer an option for only years being able to be selected?
Is this something that's better to do that with a different input type? My database column is a datatype of year(4).
My current solution is:
Is this something that's better to do that with a different input type? My database column is a datatype of year(4).
My current solution is:
TextInput::make('redacted_date_field')
->numeric()
->minValue(1900)
->maxValue(2100)
->hidden(fn(Get $get): bool => $get('redacted_bool_field') === false),
Solution:
I would do like this
Forms\Components\Select::make('year')->options(array_combine(range(2100, 1900), range(2100, 1900)))
Relation manager (Hide Table data from table record)
Hi All,
I use the table of the (in my case) ProjectResource.
In that table i want to hide one or 2 columns in the relation manager table.
Example of table.
The first Stack::make (with company.companyname and contact.full_name) needs to be vissible on the "ProjectResource" but Hidden in RalationsshipManager
`
return $table
->columns([
Split::make([
Stack::make([
TextColumn::make('company.companyname')...
I use the table of the (in my case) ProjectResource.
In that table i want to hide one or 2 columns in the relation manager table.
Example of table.
The first Stack::make (with company.companyname and contact.full_name) needs to be vissible on the "ProjectResource" but Hidden in RalationsshipManager
`
return $table
->columns([
Split::make([
Stack::make([
TextColumn::make('company.companyname')...
Solution:
Found the solution in the documentation : https://filamentphp.com/docs/3.x/panels/resources/relation-managers#hiding-a-shared-form-component-on-the-relation-manager
This also works with tables
This also works with tables
Relation managers (Hide on edit page)
Hi All,
Maybe I looked over it, but how can i hide the Relation tables on the edit page of the parent record?
It needs to be vissble only on the view of the parent.
Thanks.
Maybe I looked over it, but how can i hide the Relation tables on the edit page of the parent record?
It needs to be vissble only on the view of the parent.
Thanks.
Solution:
On the EditRecord Page add:
Does that work
protected function getRelationManagers(): array
{
return [];
}
Does that work
Message Not Public
Sign In & Join Server To View
Custom Page in menu without resource
It's possible to create a custom simple page without a resource, and add it to dashboard menu?
Solution:
Yes it is possible, depens on what you need.
You can add a page by following this documentation page : https://filamentphp.com/docs/3.x/panels/pages
You can add a page by following this documentation page : https://filamentphp.com/docs/3.x/panels/pages
Register assets per panel?
How can I register CSS per panel, all I can find is this https://filamentphp.com/docs/3.x/support/assets but this change all panel
Solution:
render hook per panels?
How to set render hook per panels?
Solution:
Message Not Public
Sign In & Join Server To View
Merge two columns into one?
Hi, I'm new using filament and what I need is simple ( I believe ) I just want to display into one column (full name) two columns from model (firstName and lastName) tried with this but didn't work ... any ideas?
Solution:
what i do is create attribute inside my model
public function getFullnameAttribute()
{
return $this->first_name.' '.$this->last_name;
}
Message Not Public
Sign In & Join Server To View
Custom card Radio Button form field
Hi,
I have build a custom form field for displaying the radio button as a card with an image. Everything is working fine but I would like to add a border to the checked radio button.
I can't really figure out how to do it in the custom view. I know tailwind has some cool peer-checked options but I cannot get it working...
Does someone have a good idea how to solve this?
Thanks!
I have build a custom form field for displaying the radio button as a card with an image. Everything is working fine but I would like to add a border to the checked radio button.
I can't really figure out how to do it in the custom view. I know tailwind has some cool peer-checked options but I cannot get it working...
Does someone have a good idea how to solve this?
Thanks!
Solution:
For others:
In your blade file you need to add this to your input field. So the state gets updated every time the user changes the input. This directly sends a request to the server everytime if ->live() is added.
<input {{ $applyStateBindingModifiers('wire:model') }}="{{ $getStatePath() }}" />
Also make sure to make the component ->live() in your resource.
Then you can add classes dynamically by checking $getState() and apply classes to it.
@if ($getState() == $value) border-2 border-green-500 @endif
In your blade file you need to add this to your input field. So the state gets updated every time the user changes the input. This directly sends a request to the server everytime if ->live() is added.
<input {{ $applyStateBindingModifiers('wire:model') }}="{{ $getStatePath() }}" />
Also make sure to make the component ->live() in your resource.
Then you can add classes dynamically by checking $getState() and apply classes to it.
@if ($getState() == $value) border-2 border-green-500 @endif
Relation Manager + Repeater?
I am using a relation manager to display daily payroll entries. When editing such an entry, I would like to be able to display all of its associated 'service members' who were active on that day, via a BelongsToMany relationship. Unfortunately, it doesn't seem that the form is adding new entries on save, despite the database being updated. Am I doing this incorrectly?
SS1: First look
SS2: Adding a new SM
SS3: After saving
(Code in thread)
SS1: First look
SS2: Adding a new SM
SS3: After saving
(Code in thread)
How can i get a value from previous column?
TextColumn::make('fileable_type')
->sortable()
->searchable()
->label('Resource')
->formatStateUsing(function ($state) {
$modelName = explode('\\', $state);
return $modelName[count($modelName) - 1];
}),
TextColumn::make('fileable_id')
->sortable()
->searchable()
->formatStateUsing(function ($state) {
// how can i get `fileable_type` here
})
i want to retrive
fileable_type
in second column.infolist not woking?
I am using infolist on a custom page but the model is not loading.
Page
```
class AccountStatements extends Page implements HasForms, HasTable, HasInfolists
{
use InteractsWithForms;
use InteractsWithTable;
use InteractsWithInfolists;
protected static ?string $navigationIcon = 'heroicon-o-cog-8-tooth';
protected static ?string $navigationGroup = 'Reports';
protected static string $view = 'filament.pages.reports.accountStatement';
protected $listeners = [...
Page
```
class AccountStatements extends Page implements HasForms, HasTable, HasInfolists
{
use InteractsWithForms;
use InteractsWithTable;
use InteractsWithInfolists;
protected static ?string $navigationIcon = 'heroicon-o-cog-8-tooth';
protected static ?string $navigationGroup = 'Reports';
protected static string $view = 'filament.pages.reports.accountStatement';
protected $listeners = [...