Single method routing

If we desire to just add one route to a single method, such as "search for accommodation", then an annotation would be added above the single method; however, this time, inside the class. To handle the GET HTTP request verb, the code would be as follows:

/**
 * Search for an accommodation
 * @Get("/search-accommodation")
 */

The class would be as follows:

<?php namespace MyCompanyHttpControllers;

use IlluminateSupportFacadesResponse;
use MyCompanyHttpRequests;
use MyCompanyHttpControllersController;
use MyCompanyAccommodation;
use IlluminateHttpRequest;

class AccommodationsController extends Controller {

    /**
    * Search for an accommodation
    * @Get("/search-accommodation")
    */
    public function index(Accommodation $accommodation)
    {
        return $accommodation->paginate();
    }
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset