#LearnLaravel
Route::apiResource vs Route::get
- apiResource creates multiple routes for typical RESTful (index, show, store, update, and destroy)
- get defines a single GET route for a specific endpoint.
#LearningLaravel
After colon ( : ), it specifies the return type.
- :View returns a Blade view (HTML content) that will be rendered in the browser.
- :RedirectResponse return a redirect response, which instructs the browser to navigate to a different URL.
#LearningLaravel
Use findOrFail when looking up a record by its primary key.
Use firstOrFail when you need to apply additional query conditions and fetch the first matching record.
#LearningLaravel
Get Data by ID, the show method's parameter is a string because the the primary key is actually a string, referring to `$table->id()`.