jjo63
jjo63
FFilament
Created by jjo63 on 1/8/2025 in #❓┊help
Infolists / Action button
Hi I have been following a tutorial here: https://laracasts.com/series/rapid-laravel-development-with-filament/episodes/14 I have followed the example and with this function in my controller I get the slideover with the named field
public function slideAction(): Action
{
return Action::make('slide')
->slideOver()
->form(
form: [
TextInput::make(name: 'name'),
]
)
->action(action: function () {
// this is the submit action so not really relevant
});
}
public function slideAction(): Action
{
return Action::make('slide')
->slideOver()
->form(
form: [
TextInput::make(name: 'name'),
]
)
->action(action: function () {
// this is the submit action so not really relevant
});
}
I have within another controller (ArchObjectResource) an infolist defined like this:
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema(components: [
Section::make(heading: 'References')
->columns(2)
->schema([
TextEntry::make(name: 'object_key'),
TextEntry::make(name: 'hcat_reference'),
...
...
...
public static function infolist(Infolist $infolist): Infolist
{
return $infolist
->schema(components: [
Section::make(heading: 'References')
->columns(2)
->schema([
TextEntry::make(name: 'object_key'),
TextEntry::make(name: 'hcat_reference'),
...
...
...
How do I (can I) replace the form definition inline with the infolist? Thx! j
1 replies
FFilament
Created by jjo63 on 1/2/2025 in #❓┊help
Custom page - invoking "standard" resource features
No description
8 replies
FFilament
Created by jjo63 on 1/1/2025 in #❓┊help
Livewire / Custom Page issue / skipRender not functioning?
Hi all, looking for some help. I have a custom page and I am evolving its functionality. It's a simple search page and it returns results and presents a "heart" icon that can be clicked to indicate a "like" - turns to red. Whenever the heart is clicked it results in part of the page being re-rendered (and the heart returns to its un-clicked state). Please see video https://www.loom.com/share/498ad9e4e57e4dbb93dc839a4c97d0ae?sid=965c6fd4-1e60-4f3e-b8e7-8676f7c92221 My blade code has an SVG <svg id="heroicon{{ $result->id }}" onclick="changeIconColor('{{ $result->id }}', event)" > ... </svg> The javascript function changeIconColor is defined as function changeIconColor(id, event) { const heroicon = document.getElementById(heroicon${id}); const currentFill = window.getComputedStyle(heroicon).getPropertyValue('fill'); if (currentFill == 'none') heroicon.style.fill = 'red'; else heroicon.style.fill = 'none'; Livewire.dispatch('toggle-state', { id: id, isActive: true }) } Note the Livewire.dispatch - this is firing - and is executing this function within the page's controller public function toggleState($id, $isActive) { $this->skipRender(); ... } As I understand it when you call a function within the controller, the blade gets re-rendered and I had hoped that adding the line $this->skipRender(); would suppress(per https://livewire.laravel.com/docs/actions#skipping-re-renders) However this doesn't seem to make a difference - and so I wondered if perhaps the problem is one of the combination of the controller being a Filament page using livewire as opposed to a livewire component. A bit puzzled about how to proceed right now would appreciate any and all suggestions. thanks, j
4 replies
FFilament
Created by jjo63 on 12/14/2024 in #❓┊help
Building own "resource" to run within the Filament UI
Hi all, can't quite figure out (and am still relatively new to laravel & filament) what steps I would need to follow to be able to add a menu option on the left (where the resource links are placed by default) which will take me to my own resource - which isn't going to return a $table or anything but will allow me to embed code the way I want that will be presented within the overall Filament UI. I'm not sure of all the terminology so not confident in googling for the answer! I have access to all the Laracasts videos so if anyone can point me to the right video or other documentation that would be fab. many thanks j
10 replies
FFilament
Created by jjo63 on 10/22/2024 in #❓┊help
Adding a record count alongside a navigation link
No description
10 replies
FFilament
Created by jjo63 on 10/21/2024 in #❓┊help
Is it possible to add a badge to top line with a number on it?
I can see in the filament demo there is a bell icon with a number just above - i'd like to implement something similar using a different icon - could anyone point me to what I need to be reading in the documentation? Clicking the bell in the demo opens a slideover with a list of the items contained within - that's what I'd like to be able to implement albeit with a different icon. Thx for pointers, j
4 replies
FFilament
Created by jjo63 on 10/19/2024 in #❓┊help
Edit form without fields
I know, it sounds daft, but I was wondering if the edit form (which I have implemented as a slideover) and from which I have removed the ability to edit any fields can be displayed without field boundaries - there is a default size for each field, some are very short content others are potentially more lengthy text. I wondered if it is possible to apply an attribute that would result in the fields actually not being displayed and whatever content is behind then just being displayed without any length constraints? Is there a different type of resource i should generate and use (and can it be accessed in the same kind of way as a slideover (not critical, but nice)? thx all, j
6 replies
FFilament
Created by jjo63 on 10/17/2024 in #❓┊help
Help! Unable to access variable values from .env
This is really bizarre. And perhaps more of a Laravel question now I think about it. But... My Filament app is able to connect to a database and display e.g. the APP_NAME - so I know that the .env file is present and has been read by Laravel /Filament core code. But - I cannot access the values from within e.g. a Widget. I have this line of code Log::info('APP_NAME:' . env('APP_NAME')); and it results in output [2024-10-17 11:45:50] local.INFO: APP_NAME: Even though the APP_NAME is clearly displayed (and has a value in the .env file) by Filament. All my code which is trying to access other variables (I was just using APP_NAME as an example) has "suddenly stopped working" - and I am thoroughly perplexed. Here is a little routine that proves the existence of the file:

$envFilePath = base_path('.env');

// Check if the .env file exists
if (file_exists($envFilePath)) {
// Open the file for reading
$envFile = fopen($envFilePath, 'r');

// Read each line and echo the contents
while (($line = fgets($envFile)) !== false) {
echo $line; // Output each line with a line break for readability
}

// Close the file after reading
fclose($envFile);
} else {
echo "The .env file does not exist.";
}

echo "FINALLY:" . env('APP_URL') . PHP_EOL;

$envFilePath = base_path('.env');

// Check if the .env file exists
if (file_exists($envFilePath)) {
// Open the file for reading
$envFile = fopen($envFilePath, 'r');

// Read each line and echo the contents
while (($line = fgets($envFile)) !== false) {
echo $line; // Output each line with a line break for readability
}

// Close the file after reading
fclose($envFile);
} else {
echo "The .env file does not exist.";
}

echo "FINALLY:" . env('APP_URL') . PHP_EOL;
But the echo of env('APP_URL') at the end gives nothing. Here is the script's output
$ php test.php APP_NAME="HCAT DB SYSTEM" APP_ENV=local APP_KEY=base64:4xxxxxxxxxxxxxxxx= APP_DEBUG=true APP_URL=https://xxxxxxxxxxxx ... ... ... FINALLY:
Any clues anyone?
18 replies
FFilament
Created by jjo63 on 9/9/2024 in #❓┊help
Application load failure on Safari but OK on Chrome
Hi all, bit of an odd one this. I developed originally using the php server and all was good. I then wanted to make the app accessible to a wider audience for evaluation and so I configured apache and setup SSL etc. The issue occurs on logging in: If I login to the app on Safari using the php server (port 8000) all OK. If I login to the app on Safari using apache (443) I get an error. If I login to the app on Chrome using apache (443) all OK. The error is
The POST method is not supported for route admin/login. Supported methods: GET, HEAD.
Any thoughts or experience of this? thanks j
13 replies
FFilament
Created by jjo63 on 8/27/2024 in #❓┊help
searchable() - accessing the search terms entered / context of results
Hi is it possible to access the search string entered in the free text box? I'm interested in being able to pull out the context of the data where the entered search terms match, It seems like a very clever bit of coding within Filament which enables matching using the entered words even when the words are not consecutive. My objective is to be able to show the user (ideally in a column in the "table view") the underlying data on which the match was made (context). For example the user types in "table mountain" and the context might be "The walkers hiked all the way to the top of Table Mountain in the searing midday heat" - so would be great to be able to pull out x words before and after the search term. Is such a thing possible?
1 replies
FFilament
Created by jjo63 on 8/21/2024 in #❓┊help
Changed behaviour of button after data change in table
Please look at the movie attached. The first time I click the "view document" button the modal pops up - and I can navigate with prev / next buttons through the records in the Filament table. I can close the modal and click a different row's button and the modal reopens. However when I change the data (e.g. apply a filter or page the results) the behaviour changes and the document opens taking the whole browser window (i.e. the modal is no longer used). Any tips on where to look first? thx j
22 replies
FFilament
Created by jjo63 on 8/20/2024 in #❓┊help
Generating some template (e.g. DIV) into a Table resource view
Hi as I understand it there are "render hooks" that can be used to inject some additional content in different places on different types of page. I have a resource called ArchFile and when we present the table of records I'd like (within that page) to be able to include some additional HTML (defines some divs needed for a modal iframe). My knowledge again is inadequate to understand how to achieve this. I was reading here https://filamentphp.com/docs/3.x/support/render-hooks and thought that this would be an appropriate use for my needs:
FilamentView::registerRenderHook(
TablesRenderHook::HEADER_AFTER,
fn (): View => view('my_extra_html'),);
FilamentView::registerRenderHook(
TablesRenderHook::HEADER_AFTER,
fn (): View => view('my_extra_html'),);
The documentation says
To register render hooks, you can call FilamentView::registerRenderHook() from a service provider or middleware.
I am not sure what that means but I'm guessing that my ArchFileResource.php file is not the place. In a default install of Filament, where might i add this code? Thanks for all help & comments, j
4 replies
FFilament
Created by jjo63 on 8/18/2024 in #❓┊help
Styling a custom column
Hi I have a custom column used in a table like this
return $table
->columns([

doclink::make(name: 'sp_file_id')
,
return $table
->columns([

doclink::make(name: 'sp_file_id')
,
I was assuming (wrongly 🙂 ) that I could style it using the options available on text columns (e.g. ->badge() ) but see that this is not valid. Is there a standard way of enabling such styling options? thanks j
3 replies
FFilament
Created by jjo63 on 8/16/2024 in #❓┊help
->description() - is it possible to further style?
Table columns and using the ->description() method (correct term?) for example like this
Tables\Columns\TextColumn::make('name')
->label('Filename')
->description('my description')
->sortable(),
Tables\Columns\TextColumn::make('name')
->label('Filename')
->description('my description')
->sortable(),
Is it possible to apply styling to the description (such as badge and setting a colour)? I don't think that description() supports this natively and am sure that there is a method to further style using some kind of custom code but wouldn't know where to start on this. Any pointers? thx j
6 replies
FFilament
Created by jjo63 on 8/16/2024 in #❓┊help
GetStateUsing - when can it be used? One example that works, one that doesn't
Hi all, GetStateUsing - have found this useful - here is an example of it being used to retrieve the description from an array - and this works beautifully
public static function table(Table $table): Table
{
// populate array of folders
$folders = DB::table('arch_folders')
->orderBy('id')
->pluck('name', 'id')
->toArray();
return $table
->columns([

Tables\Columns\TextColumn::make('name')
->label('Filename')
->description(function ($record, $state) use ($folders) {

return 'Folder: ' . $folders[$record->arch_folder_id] ?? null;
})
->sortable(),
public static function table(Table $table): Table
{
// populate array of folders
$folders = DB::table('arch_folders')
->orderBy('id')
->pluck('name', 'id')
->toArray();
return $table
->columns([

Tables\Columns\TextColumn::make('name')
->label('Filename')
->description(function ($record, $state) use ($folders) {

return 'Folder: ' . $folders[$record->arch_folder_id] ?? null;
})
->sortable(),
In this case we are displaying the name of a file and underneath (in the description) pulling the name of the folder based on its entry in an array $folders I thought that I could make the folder name itself a column by doing this
public static function table(Table $table): Table
{
// populate array of folders


$folders = DB::table('arch_folders')
->orderBy('id')
->pluck('name', 'id')
->toArray();


return $table
->columns([
Tables\Columns\TextColumn::make('Folder')
->label('Folder')
->getStateUsing(function ($record, $state) use ($folders){
return $folders[$record->arch_folder_id] ?? null;
}
),
public static function table(Table $table): Table
{
// populate array of folders


$folders = DB::table('arch_folders')
->orderBy('id')
->pluck('name', 'id')
->toArray();


return $table
->columns([
Tables\Columns\TextColumn::make('Folder')
->label('Folder')
->getStateUsing(function ($record, $state) use ($folders){
return $folders[$record->arch_folder_id] ?? null;
}
),
When I run this version the browser just hangs eventually saying it's unable to get a response - and the php http server will not respond to any other requests until I kill & restart it. Is my use of GetStateUsing in example 2 incorrect? No errors reported in storage/logs/laravel.log nor in the php http server output. thanks - not critical (I can workaround) but thought I'd flag it to see if it's my error or ..., j
6 replies
FFilament
Created by jjo63 on 8/14/2024 in #❓┊help
Filament Tables - listwithlinebreaks() - what am I doing wrong?
No description
6 replies
FFilament
Created by jjo63 on 8/6/2024 in #❓┊help
Hide Resources from Panel
Hi I am sure this is simple but cannot see how this is achieved. Say I have a resource "pets" - I get a number of php dfiles generated for this and a link is added to the admin panel - this all happens automatically. I'm doing POC stuff and I'd like to keep what I have (code for reference) but not have the resources cluttering up my admin panel - what's the method (short of deleting the files) to remove them from the view of the user? I guess one option would be to create a new Laravel app 🙂 or to create a new admin panel - but just wanted to know if there is a simple way to achieve the hiding of resources that you don't actually want to see? thanks j
4 replies
FFilament
Created by jjo63 on 7/29/2024 in #❓┊help
Using jquery within a blade in Filament
No description
2 replies
FFilament
Created by jjo63 on 7/29/2024 in #❓┊help
Generic process for installing plugins?
Hi a little confused - I wanted to use this plugin https://github.com/solutionforest/Filament-SimpleLightBox I ran the composer command
composer require solution-forest/filament-simplelightbox
composer require solution-forest/filament-simplelightbox
No problems. I modified my file app/Providers/Filament/AdminPanelProvider.php to add the line referencing the plugin
class AdminPanelProvider extends PanelProvider
{

public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')

<snip of default code>

->plugin(SimpleLightBoxPlugin::make())
;
}
}
class AdminPanelProvider extends PanelProvider
{

public function panel(Panel $panel): Panel
{
return $panel
->default()
->id('admin')
->path('admin')

<snip of default code>

->plugin(SimpleLightBoxPlugin::make())
;
}
}
When I tried to reload my app, I get an error Class "App\Providers\Filament\SimpleLightBoxPlugin" not found As there were no other installation / pre-req usage instructions I wondered whether this is me being ignorant of some typical steps you'd follow or if this is actually an issue with the installation of the plugin. Any pointers? thanks j
6 replies
FFilament
Created by jjo63 on 7/26/2024 in #❓┊help
Odd "jumping" behaviour when using a toggle
No description
18 replies