laravel route segment code example

Example 1: laravel get url segment

{{ Request::segment(1) }}

Example 2: delete route method in laravel

<form method="POST" action="{{ route('route.name', [ 'id'=> $item->id ]) }}">
              @csrf
              <input type="hidden" name="_method" value="DELETE">
              <button type="submit" class="btn btn-danger btn-icon">
                <i data-feather="delete"></i>
              </button>
            </form>

Example 3: laravel routes return view in web.php

Route::get("/page", function(){
   return View::make("dir.page");
});

Example 4: laravel route

Route::get('posts/{post}/comments/{comment}', function ($postId, $commentId) {
    //
});