Tjiel
Tjiel
FFilament
Created by Tjiel on 6/21/2024 in #❓┊help
How can I display a file uploaded using the spatie media library on the info list page
Hey all!, in my filament project I'm making use of of the spatie media library for filament (https://filamentphp.com/plugins/filament-spatie-media-library). Although there is a way to display an image on the infolist, as specified in the documentation. I can not find a way to display non-image files with just a file name and a download button. If anyone knows how I might be able to do this or something else that is similar, please let me know.
2 replies
FFilament
Created by Tjiel on 6/17/2024 in #❓┊help
Embedded youtube video in rich editor
Hey all, I want the user to be able to add an embedded youtube video to the rich editor. Is there any way to do this using the rich editor filament provides, or are there any alternative plugins that offer this functionality.
2 replies
FFilament
Created by Tjiel on 6/11/2024 in #❓┊help
Looking for a way to change the logo based on the tenant.
Hey all, I am currently working on a project with multi tenancy, the tenant is based on the domain. As of now I have done the tenant styling using a middleware I made, here is the start of it:
public function handle(Request $request, Closure $next): Response
{
$tenant = tenant();

if ($tenant) {
if ($tenant->admin_primary_color) {
FilamentColor::register(['primary' => $tenant->admin_primary_color]);
}
public function handle(Request $request, Closure $next): Response
{
$tenant = tenant();

if ($tenant) {
if ($tenant->admin_primary_color) {
FilamentColor::register(['primary' => $tenant->admin_primary_color]);
}
This is working as intended but when I looked up on how to change the logo (preverably in a similar way), I could not find anything. So my question is if anyone knows how I might add functionality to my theming middleware, so I can update the logo using the tenants logo. Of course any recommendations for doing it outside the middleware are also welcome.
4 replies
FFilament
Created by Tjiel on 6/7/2024 in #❓┊help
Is there a way to use the filament colors in a custom theme
Hey all, I am working on a project with multi tenancy and I want to use the tenant's colors to be used in a custom theme. Currently I have a middleware to set the filament colors:
public function handle(Request $request, Closure $next): Response
{
$tenant = tenant();

if ($tenant) {
if ($tenant->admin_primary_color) {
FilamentColor::register(['primary' => $tenant->admin_primary_color]);
}
public function handle(Request $request, Closure $next): Response
{
$tenant = tenant();

if ($tenant) {
if ($tenant->admin_primary_color) {
FilamentColor::register(['primary' => $tenant->admin_primary_color]);
}
This is working great, but the problem i'm having is that I want to change the colors of the sidebar, topbar and more. I already have created a custom theme, here is the start of it:
@import '/vendor/filament/filament/resources/css/theme.css';

@config 'tailwind.config.js';

.fi-sidebar-header, .fi-topbar > nav, .fi-body {
background-color: #EE8225;
}
@import '/vendor/filament/filament/resources/css/theme.css';

@config 'tailwind.config.js';

.fi-sidebar-header, .fi-topbar > nav, .fi-body {
background-color: #EE8225;
}
So basicly my question is, how can I use the registered primary color in the theme.css, so I can for example change the background color of the sidebar.
17 replies
FFilament
Created by Tjiel on 6/5/2024 in #❓┊help
Looking for a way to get a time range value input field
No description
9 replies
FFilament
Created by Tjiel on 5/27/2024 in #❓┊help
How to change capitalization on model label?
Hey all a resource for my model QrCodes, in this model I have set the model label the following way:
public static function getModelLabel(): string
{
return __('QR access code');
}

public static function getPluralModelLabel(): string
{
return __('QR access codes');
}
public static function getModelLabel(): string
{
return __('QR access code');
}

public static function getPluralModelLabel(): string
{
return __('QR access codes');
}
The problem im having is that its displaying Qr Access Codes instead of QR access codes. According to the documentation you can prevent default the default capitalization in the following way:
protected static bool $hasTitleCaseModelLabel = false;
protected static bool $hasTitleCaseModelLabel = false;
https://filamentphp.com/docs/3.x/panels/resources/getting-started#automatic-model-label-capitalization But variable is not reconized and doesn't do anything. So my question is if anybody knows how I might solve this problem.
13 replies
FFilament
Created by Tjiel on 5/21/2024 in #❓┊help
Looking for a way to display files from spatie media library in the infolist.
Hey all, Im currently creating an infolist for a resource that has multiple file uploads, the image uploads I can display fine using the document infolist entry (https://filamentphp.com/plugins/filament-spatie-media-library#infolist-entry). The problem comes when I need to display different files on the infolist. So my question is if there is a way to show these filenames and make them downloadable? and if so, how can I do that?
1 replies
FFilament
Created by Tjiel on 5/13/2024 in #❓┊help
Looking for an openinghours form field in filament
Hey all, Im currently migrating a project from nova to fillament. In my nova project I have the following package for an OpeningHours input field: SadekD\NovaOpeningHoursField\NovaOpeningHoursField. So my question is the following: Is there any good alternative package to do something similar using Filament.
8 replies
FFilament
Created by Tjiel on 4/26/2024 in #❓┊help
Image saved to AWS bucket not displayed on infolist.
Hey all, I have a form with the fileupload:
Forms\Components\FileUpload::make('banner')
->label('Banner')
->translateLabel()
->image()
->acceptedFileTypes(['image/*'])
->maxSize(4096)
->disk('s3')
->directory('events/banners'),
Forms\Components\FileUpload::make('banner')
->label('Banner')
->translateLabel()
->image()
->acceptedFileTypes(['image/*'])
->maxSize(4096)
->disk('s3')
->directory('events/banners'),
When submitting it seems to be working fine, the problem is that whenever I go to the view page, the image is not displaying. When inspecting, the img element doesn't have an src (<img src style="). This is what im trying in my infolist:
ImageEntry::make('banner')
->label('Banner')
->translateLabel()
->disk('s3')
->columnSpan(2),
ImageEntry::make('banner')
->label('Banner')
->translateLabel()
->disk('s3')
->columnSpan(2),
So if anyone knows a possible solution, please let me know. If i should clarify some more, please let me know and I'm happy to do so.
3 replies
FFilament
Created by Tjiel on 4/17/2024 in #❓┊help
How can I make a filter not changeable by the user?
I have filter that has a default value, the problem is that the user can change this filter, which I don't want the user to be able to do. I prefer a way to make it so the user doesn't see there are filters and there is no filter icon to be clicked on. But it would also be good enough if the user just could not change them.
5 replies
FFilament
Created by Tjiel on 4/16/2024 in #❓┊help
Parameter being null after table action
I have a widget that refreshes the page with a custom parameter. I use this parameter to manipulate a different widget, which needs a page refresh. And to update the getTableQuery method.
protected function getTableQuery(): Builder
{
if (Request::query('location')) {
switch (Request::query('location')){
case 'all': return parent::getTableQuery();
case 'allDeleted': {
return Asset::onlyTrashed();
}
default: {
$location = Location::findOrFail(Request::query('location'));
$assetIds = $location->assets->pluck('id')->toArray();
return parent::getTableQuery()->whereIn('id', $assetIds);
}
}
}
dd(Request::query('location'));
$location = Location::first();
if ($location) {
$assetIds = $location->assets->pluck('id')->toArray();
return parent::getTableQuery()->whereIn('id', $assetIds);
}
return parent::getTableQuery();
}
protected function getTableQuery(): Builder
{
if (Request::query('location')) {
switch (Request::query('location')){
case 'all': return parent::getTableQuery();
case 'allDeleted': {
return Asset::onlyTrashed();
}
default: {
$location = Location::findOrFail(Request::query('location'));
$assetIds = $location->assets->pluck('id')->toArray();
return parent::getTableQuery()->whereIn('id', $assetIds);
}
}
}
dd(Request::query('location'));
$location = Location::first();
if ($location) {
$assetIds = $location->assets->pluck('id')->toArray();
return parent::getTableQuery()->whereIn('id', $assetIds);
}
return parent::getTableQuery();
}
This is working fine on the initial loading of the page, as you would expect the Request::query('location') is present and it applies the correct filters. The problem comes when trying to do a table action like delete, restore or any custom action. Then it is null, as i can see using the dd method. Why might this be and how can i make it so it will detect the location.
7 replies
FFilament
Created by Tjiel on 4/12/2024 in #❓┊help
Change default table query to get only the soft deleted records
Hello all, For a project im working on I need my table results to only show the soft deleted records.
protected function getTableQuery(): Builder
{
return parent::getTableQuery();
}
protected function getTableQuery(): Builder
{
return parent::getTableQuery();
}
I want it so that instead of currently returning the default parent::getTableQuery instead a where or something like that that makes it so it only gets soft deleted records.
9 replies
FFilament
Created by Tjiel on 4/11/2024 in #❓┊help
Action on press of record in table?
I have the following actions in my AssetResource:
->actions([
Tables\Actions\Action::make('action')
->label('Action')
->translateLabel()
->action(function () {
// Action logic
}),
DefaultActionGroup::make(),
])
->actions([
Tables\Actions\Action::make('action')
->label('Action')
->translateLabel()
->action(function () {
// Action logic
}),
DefaultActionGroup::make(),
])
Is there a way that instead of creating a text where, when pressed on, performs the action. You can just click on the row of the record. Currently whenever I press on the record it just goes to the view page.
4 replies
FFilament
Created by Tjiel on 4/10/2024 in #❓┊help
How can I refresh the page after a filter is changed
Hey all, I am currently looking for a way to refresh the whole page whenever a filter of a table is changed. The reason for this is that I have a widget with a mapping tool. And whenever the filter is changed I want it to change map. The problem is that the map of this mapping tool, can not be changed unless the page is reloaded. These are my current filters:
->filters([
Tables\Filters\TrashedFilter::make(),
Tables\Filters\SelectFilter::make('locations')
->relationship('location', 'name')
])
->filters([
Tables\Filters\TrashedFilter::make(),
Tables\Filters\SelectFilter::make('locations')
->relationship('location', 'name')
])
Preferably it only refreshes the page when the transmitters filter gets changed, but I won't mind if there is a solution where it happens if either one gets updated.
8 replies
FFilament
Created by Tjiel on 4/5/2024 in #❓┊help
Can an action from a table call an event inside a widget?
Hey all, I am currently working on a system where I have a resource called assetResource. On the ListAssets page I have a widget that shows a map using a mapping tool. This mapping tool can highlight/target a locations using an id. I want it so that whenever I click on the asset in the table or perform an action for an asset, the map highlights/targets the location on the map. So my question is, what is the best way to implement this? If anything is not clear, or if any code is needed please let me know.
5 replies