laravel route in js code example
Example 1: call laravel route js
function confirmDelete(id){
let url = "{{ route('getDeleteRequest', ':id') }}";
url = url.replace(':id', id);
document.location.href=url;
}
Example 2: laravel route
Route::get('user/{name}', function (Request $request) {
return $request->route('name');
});
Example 3: laravel route
Route::get('user/profile', [UserProfileController::class, 'show'])->name('profile');
Example 4: laravel route
Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
});