Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What Laravel API create and edit methods should return?

Tags:

php

laravel

I had a question about the APIs. The methods that Laravel resource creates are create, edit, show, update, destroy, store. The methods update, show, destroy and store are understandable (object manipulation), but what should an API return in create and edit methods? html forms for creating and editing? and what if the API is JSON?

like image 295
MattJ Avatar asked Dec 29 '25 20:12

MattJ


1 Answers

They are not needed for an API. You can disable them like this:

Route::resource("post", "PostsController", ["except" => ["create", "edit"]]);
like image 170
Alex Lomia Avatar answered Dec 31 '25 12:12

Alex Lomia