Show data that does not come from the DB
How could I show data on the edit or view screen that does not come from the database, for example, from an API, or IP data through Geoip.
You would also have to have access to the model to obtain its data to be able to make the query.
11 Replies
I have seen that there is a package called sushi, but in my case it does not work, what I want to do is, for example:
When you edit or view a user, have all the user's data obtained from the DB and in a new section, given the IP, country, city...
To get the IP data, you would have to get the model's ip field, do the search to get all the data for that IP, and then display it in different fields.
https://v2.filamentphp.com/tricks/search-load-form-data-from-an-api and https://v2.filamentphp.com/tricks/geocoding-field-using-select-component show examples of something that’s similar to what you are trying to achieve.
Filament
Search & load form data from an API by Z3d0X - Tricks - Filament
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Filament
Geocoding field using Select component by Dennis Koch - Tricks - Fi...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
I've mentioned it before, sushi doesn't work for me.
then forget it or make it work
These examples are for input components, I only want to show information, which cannot be updated or anything, just view
As you mentioned the edit page I thought inputs were involved
You can show data in disabled / non editable input fields (nicely gathered in a section or fieldset for example). Fetching the external data can happen on some click or pageload.
If the 3rd party data doesn’t change often consider fetching and storing it.
if it's only one page create a custom page and fetch data there
otherwise pages for now needs to have eloquent query
By doing tests, I have found a way to display data, but I don't know if it is the most correct or if there is some component that does not require a query to work.
if it's just for this one field then this is the way
From GeoIp you can obtain accuracy radius, Latitude/Longitude, continent, country, subdivisions, city, postal code, currency, therefore, I would have to create a placeholder for each one and I don't know if there is any way for state to receive all this data , instead of having to access GeoIp on each Placeholder
If it is not possible, I will have to make more logic in GeoIp so that instead of every time find is called it searches for the data within a database, it saves it in a variable so that it is faster when other placeholders call it