Skip to content
This repository has been archived by the owner. It is now read-only.
Route::view('example'); forget using closures when only returning views.
PHP HTML
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
src
tests
.gitignore
.travis.yml
LICENSE
README.md
composer.json
phpunit.xml.dist

README.md

Laravel route view helper

Build Status Total Downloads Latest Stable Version Latest Unstable Version License

Syntactic sugar for those occasions when you only want to display a basic view.

This package adds a Route::view() helper method so you don't have to create a closure when all you are returning is a view.

Installation

Begin by installing the package through Composer.

$ composer require brayniverse/laravel-route-view-helper

Then add the following to your providers array in config/app.php.

Brayniverse\LaravelRouteViewHelper\ServiceProvider::class

Usage

Normally you'd have to return a view in either a controller method or callback like the following:

public function contact()
{
  return view('contact');
}

// or

Route::get('/contact', function () {
  return view('contact');
});

Now you can do the same in one line.

Route::view('/contact', 'contact');

Credits

You can’t perform that action at this time.