src/Collectors/ResourceCollectorTrait.php
public function resource($controller, array $options = array())
    {
        $name       = isset($options["prefix"]) ? $options["prefix"] : "";
        $name      .= $this->getResourceName($controller, $options);
        $actions    = $this->getResourceActions($options);
        $resource = new RouteResource;

        foreach ($actions as $action => $map) {
            $resource->set(
                $this->set(
                    $map[0],
                    $this->getResourcePath($action, $map[1], $name, $options),
                    [$controller, $action]
                )
                    ->setName("$name.$action")
            );
        }

        return $resource;
    }
public function resource($controller, array $options = array())
    {
        $name       = isset($options["prefix"]) ? $options["prefix"] : "";
        $name      .= $this->getResourceName($controller, $options);
        $actions    = $this->getResourceActions($options);
        $resource = new RouteResource;

        foreach ($actions as $action => $map) {
            $resource->set(
                $this->set(
                    $map[0],
                    $this->getResourcePath($action, $map[1], $name, $options),
                    [$controller, $action]
                )
                    ->setName("$name.$action")
            );
        }

        return $resource;
    }
public function resource ( $ controller , array $ options = array ( ) ) { $ name = isset ( $ options [ "prefix" ] ) ? $ options [ "prefix" ] : "" ; $ name .= $ this -> getResourceName ( $ controller , $ options ) ; $ actions = $ this -> getResourceActions ( $ options ) ; $ resource = new RouteResource ; foreach ( $ actions as $ action => $ map ) { $ resource -> set ( $ this -> set ( $ map [ 0 ] , $ this -> getResourcePath ( $ action , $ map [ 1 ] , $ name , $ options ) , [ $ controller , $ action ] ) -> setName ( "$name.$action" ) ) ; } return $ resource ; }
Resource routing allows you to quickly declare all of the common routes for a given resourceful controller.
Instead of declaring separate routes for your index, show, new, edit, create, update and destroy actions,
a resourceful route declares them in a single line of code.

@param string $controller The controller name.
@param array  $options    Some options like, "as" to name the route pattern, "only" to
explicit say that only this routes will be registered, and
"except" that register all the routes except the indicates.
@return RouteResource
Resource routing allows you to quickly declare all of the common routes for a given resourceful controller . Instead of declaring separate routes for your index show new edit create update and destroy actions a resourceful route declares them in a single line of code .