示例#1
0
 /**
  * Call this method once you're done registering additional routes to the current resource.
  * The original RouteHelper instance is returned, allowing infinite chaining of ordinary routes and resources.
  *
  * @return RouteHelper
  */
 public function done()
 {
     if (in_array(self::INDEX, $this->methods)) {
         $this->routeHelper->get($this->name, $this->controller, self::INDEX);
         if ($this->pagination) {
             $this->routeHelper->pagination($this->name, $this->controller, self::INDEX);
         }
     }
     if (in_array(self::SHOW, $this->methods)) {
         $this->routeHelper->get($this->name . '/{' . $this->name . '}', $this->controller, self::SHOW);
     }
     if (in_array(self::STORE, $this->methods)) {
         $this->routeHelper->post($this->name, $this->controller, self::STORE);
     }
     if (in_array(self::UPDATE, $this->methods)) {
         $this->routeHelper->put($this->name . '/{' . $this->name . '}', $this->controller, self::UPDATE);
         $this->routeHelper->patch($this->name . '/{' . $this->name . '}', $this->controller, self::UPDATE);
     }
     if (in_array(self::DESTROY, $this->methods)) {
         $this->routeHelper->delete($this->name . '/{' . $this->name . '}', $this->controller, self::DESTROY);
     }
     return $this->routeHelper;
 }