F
Filamentβ€’2y ago
Peagah

How to consume an external API with Filament Tables

I've been trying to use this method to consume an external API with the filament tables but it's giving me an error, can anyone tell me if there is another way?
No description
49 Replies
rg.block
rg.blockβ€’2y ago
What is the code you have and what error are you getting? Have you looked into https://docs.saloon.dev ? I am not sure how you are envisioning using the API but with Saloon you can create your connectors and requests to process data, and then have that data displayed on your tables and forms.
Saloon
Build beautiful API integrations and SDKs with Saloon
Peagah
PeagahOPβ€’2y ago
Filament
How to consume an external API with Filament Tables by Leandro C. F...
Filament is a collection of tools for rapidly building beautiful TALL stack apps, designed for humans.
Patrick Boivin
Patrick Boivinβ€’2y ago
@pea_gah Can you share your Sushi model?
Peagah
PeagahOPβ€’2y ago
The same as here, but here a screenshot
No description
Patrick Boivin
Patrick Boivinβ€’2y ago
I see. Can you run this command and share the output?
php -i | grep -i sqlite
php -i | grep -i sqlite
Peagah
PeagahOPβ€’2y ago
No description
Peagah
PeagahOPβ€’2y ago
Maybe i need to active sqlite extension on php.ini ?
Patrick Boivin
Patrick Boivinβ€’2y ago
Oh is this windows/powershell? But yeah, I'm thinking the sqlite extension is not installed or active... you need it with Sushi
Peagah
PeagahOPβ€’2y ago
Let me try Was active... Yes
Patrick Boivin
Patrick Boivinβ€’2y ago
if you run php -i (without the rest), can you see this text?
SQLite3 support => enabled
SQLite3 support => enabled
Peagah
PeagahOPβ€’2y ago
No description
Patrick Boivin
Patrick Boivinβ€’2y ago
Very weird... Can you try php artisan tinker Then type Product::all()
Peagah
PeagahOPβ€’2y ago
I'm thiking that too πŸ˜…
No description
Patrick Boivin
Patrick Boivinβ€’2y ago
\App\Models\Product::all()
Peagah
PeagahOPβ€’2y ago
No description
Patrick Boivin
Patrick Boivinβ€’2y ago
lol, we'll get there Can you replace the call to the fake API with some static data?
return [
['id' => 1, 'label' => 'admin'],
['id' => 2, 'label' => 'manager'],
['id' => 3, 'label' => 'user'],
];
return [
['id' => 1, 'label' => 'admin'],
['id' => 2, 'label' => 'manager'],
['id' => 3, 'label' => 'user'],
];
Peagah
PeagahOPβ€’2y ago
Very weird...
No description
Peagah
PeagahOPβ€’2y ago
No description
Patrick Boivin
Patrick Boivinβ€’2y ago
Check in storage/framework/cache, do you see any .sqlite files?
Peagah
PeagahOPβ€’2y ago
No description
Patrick Boivin
Patrick Boivinβ€’2y ago
Delete it and try again
Peagah
PeagahOPβ€’2y ago
Same as before Maybe i ill just try this package
Patrick Boivin
Patrick Boivinβ€’2y ago
Sounds good
Peagah
PeagahOPβ€’2y ago
The problem was that I use Laragon for hosting, and the sqlite extension there was disabled. @pboivin Ty for help!
Patrick Boivin
Patrick Boivinβ€’2y ago
Ah, totally makes sense. You're welcome πŸ™Œ
Urufu
Urufuβ€’2y ago
Hi, did Saloon work for you? Could you show an example of how you used it?
Peagah
PeagahOPβ€’2y ago
@_urufu Hello, I did not use Saloon, but this method here But apparently the author deleted the post, I can show you my code of how it turned out
Urufu
Urufuβ€’2y ago
i think the new link is this https://filamentphp.com/community/how-to-consume-an-external-api-with-filament-tables , but can u show me your code please
Filament
How to consume an external API with Filament Tables by Leandro Ferr...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
Peagah
PeagahOPβ€’2y ago
No description
No description
Peagah
PeagahOPβ€’2y ago
I was using a Currencies API
Urufu
Urufuβ€’2y ago
thanks so much
Peagah
PeagahOPβ€’2y ago
If you still need help, just call me πŸ™‚
AliBabba420
AliBabba420β€’2y ago
@pea_gah Bro i just create an api which get some record (15000+) with pagination and that api i call in a model as you write but it shows me could not find driver error and create that table in which I want to show the records, and one more thing the resource and model is already created and also table
Peagah
PeagahOPβ€’2y ago
@noobita1012 Sorry for the delay, I had a problem with a similar driver, check your php.ini if ​​your database extension is active. In case you use XAMPP, Laragon or something like that, make sure to enable the database extensions as well, this should fix the driver issues.
AliBabba420
AliBabba420β€’2y ago
Bro i am use postgresql
Peagah
PeagahOPβ€’2y ago
Can you check in your php.ini if ​​the extension is enabled?
AliBabba420
AliBabba420β€’2y ago
Ok let me check once, but thanku for reply
Peagah
PeagahOPβ€’2y ago
See if extension=pgsql and extension=pdo_pgsql are enabled @noobita1012 It worked?
AliBabba420
AliBabba420β€’2y ago
my php.ini
No description
Peagah
PeagahOPβ€’2y ago
You are using postgres, right?
AliBabba420
AliBabba420β€’2y ago
yes
Peagah
PeagahOPβ€’2y ago
Uncomment these two extensions After uncommenting try running the code again, it should be working now
AliBabba420
AliBabba420β€’2y ago
no the same issue is still there
Peagah
PeagahOPβ€’2y ago
Do you use xampp, laragon or something similar? In my case, this same error that is happening to you was solved in the way I commented above, but I had to do the same in the php.ini of laragon
AliBabba420
AliBabba420β€’2y ago
bro i am really sry i don't have the sqllite extension so the error of could not find the driver arises from there
Peagah
PeagahOPβ€’2y ago
That's make sense, I'm glad you managed to solve it
AliBabba420
AliBabba420β€’2y ago
yeah ! one more thing i wnt to show the data of my api in resource table but while create the form of that resource i wnt it should store in my migration table? is it possible like resource data should show in the table but create data should store in the local database table
Peagah
PeagahOPβ€’2y ago
Hello, I was a little confused by your description of how you want to do it, but I'll give you an example of how I did it. I had a project to list currencies from an API and make their conversion and the operation be stored in the database, the following prints show how the code turned out, I hope it helps you.
No description
No description
No description
No description
No description
No description
Peagah
PeagahOPβ€’2y ago
You can open it in the browser to get a better view.

Did you find this page helpful?