filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
18.2k stars 2.84k forks source link

Ability for Form Placeholder to poll #13479

Open danharrin opened 3 months ago

danharrin commented 3 months ago

Discussed in https://github.com/filamentphp/filament/discussions/13459

Originally posted by **SimonMacIntyre** July 3, 2024 We make use of Placeholder in forms, to show data related to the entity. For example let's say we have an EditUser page and form. We are using Placeholder as an example while viewing this page, to show some interesting live updating status about some thing based on this user. (Note: This is not suitable to be in a table/relation manager, we make heavy use of that too, but this specifically is a component we want to show right up in the form in a read-only fashion, but have it live-update). Any chance of this being a feature we can add some day? Ideally it would be as simple as... ```php Placeholder::make('status')->poll(5)->... ```

Donate 💰 to fund this issue

Fund with Polar

danharrin commented 3 months ago

cc @SimonMacIntyre

alvleont commented 2 months ago

I can make it work just by adding to the TextEntry the following trait:

use CanPollRecords;

And the corresponding polling validator in the blade view:

@if ($pollingInterval = $getPollingInterval()) wire:poll.{{ $pollingInterval }} @endif

https://github.com/user-attachments/assets/7e6d18ad-f3ac-4237-93b0-9355c5d2813e

However, it seems that Placeholder will be deprecated. Am I right?

Image

SimonMacIntyre commented 2 months ago

Interesting, I'll give that a try, and also take a look at the TextEntry and if that is also pollable or not, thanks for the comment!

alvleont commented 2 months ago

It isn't. I mean, this is a code proposal for V4, but I guess I need some guidance before making a PR.