Eudemon
139
13
Laravel

Adding new API endpoint

Posted 5 months ago by Eudemon

I have a custom table created and stored custom data,

I want to create API end point to retrieve data from that table,

all the guides I read tells me to create a resource and resource controller,

then add the route to api.php

with a toArray function in CustomResource returning 'id' 'fields', but how does laravel know i want to pull my custom table? I don't see how they are linked together

when I access the api url /api/custom/{id} it return class 'custom' does not exist

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.