cloudcreativity/laravel-json-api

Question: Contact Form endpoint without model binding

Closed this issue · 2 comments

Hey guys,

I want to add a contact form endpoint but don't have or need a model. We're just going to send an email. What should be done in the config/resources? Does a route need to be bound to a model?

Thanks for any tips.

You'd need to implement a custom (non-Eloquent) resource to do this. Which will require implementing quite a lot of things - e.g. adapters - which aren't really necessary because you're not storing the resource on the server-side.

So it might just be best to implement a normally Laravel controller action that deals with this, but expects the contact form data to be formatted as a JSON API payload? Or just use an action that expects a normal application/json payload.

Closing this due to lack of activity; think the question was answered.