laravel api route code example
Example 1: route() and with() in laravel
Route::get('user/{id}/profile', function ($id) {
})->name('profile');
$url = route('profile', ['id' => 1, 'photos' => 'yes']);
Example 2: laravel grouping routes
Route::middleware(['first', 'second'])->group(function () {
Route::get('/', function () {
});
Route::get('/user/profile', function () {
});
});
Example 3: laravel api routes
Route::get($uri, $callback);
Route::post($uri, $callback);
Route::put($uri, $callback);
Route::patch($uri, $callback);
Route::delete($uri, $callback);
Route::options($uri, $callback);
Example 4: laravel route
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');