Laravel Custom Route and View

Laravel Custom Route and View

Now we will create our own route and view with our own customize name and desired output whatever we want. Now we create route with name contact and view with same name.

  1. For this Go to Routes Folder and work on web. Php file


Route::get(‘/contact’, function(){

           return view(‘contact);


Here we return view instead of this we can return string and Json also

  • Like return ‘contact’
  • Return[‘name’=>’shairy’, ’phone’=>’8054583502’]
  • Now Click on the view folder and create a new file with name contact.blade.php.

For a while copy the welcome. blade php content to contact.blade.php and change the content whatever you want

Save both the file and open this route in browser and check the output

Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *