Answer the question
In order to leave comments, you need to log in
What is the best way to get data for create/edit forms?
Laravel + Vue - but this is not essential for the question
How to correctly (best practices) form creation / editing forms in a SPA application when there are select elements in the forms with data from different database tables?
For example, in the Users form, fields with the choice of role / company / city / etc. are needed. Accordingly, when displaying the form, it is necessary to load the data for these selects.
In non-SPA applications, I used the Create - Edit methods in the controllers and returned the rendered Blade with all the data.
In SPA, the backend acts as an api, and when registering routes
// routes\api.php
Route::apiResource('users', 'UserController');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question