Laravel: Difference between revisions
No edit summary |
|||
Line 32: | Line 32: | ||
# Use npm run prod for production | # Use npm run prod for production | ||
npm run dev | npm run dev | ||
</syntaxhighlight> | |||
==Routing== | |||
Routing is handled in the <code>routes/web.php</code> file.<br> | |||
[https://laravel.com/docs/6.x/routing Documentation] | |||
==RESTful=== | |||
Note that for put, patch, delete you will need <code>@method('PATCH')</code> in your form html element.<br> | |||
Or you can use an ajax request via fetch or jQuery. | |||
<syntaxhighlight lang="php"> | |||
Route::get($uri, $callback); | |||
Route::post($uri, $callback); | |||
Route::put($uri, $callback); | |||
Route::patch($uri, $callback); | |||
Route::delete($uri, $callback); | |||
Route::options($uri, $callback); | |||
</syntaxhighlight> | |||
===Parameters/Variables=== | |||
<syntaxhighlight lang="php"> | |||
Route::get('user/{id}', function ($id) { | |||
return 'User '.$id; | |||
}); | |||
</syntaxhighlight> | </syntaxhighlight> | ||