Example #1
0
 /**
  * Execute an action on the controller.
  *
  * @param  string  $method
  * @param  array   $parameters
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function callAction($method, $parameters)
 {
     $this->setupLayout();
     $response = call_user_func_array(array($this, $method), $parameters);
     if ($response instanceof View && !$this->layout->offsetExists('content')) {
         return $this->layout->with('content', $response);
     }
     return $response;
 }
Example #2
0
 /**
  * @param View $view
  */
 public function compose(View $view)
 {
     if ($view->offsetExists('revision')) {
         $revision = $view->offsetGet('revision');
     } else {
         if ($view->offsetExists('law')) {
             $law = $view->offsetGet('law');
             $revision = $law->active_revision()->first();
         } else {
             abort(404, 'No law or revision passed.');
         }
     }
     $is_raw = $view->offsetExists('raw') && $view->offsetGet('raw');
     $view->with('meta', $this->getLawMetaData($revision));
     $view->with('text', $this->getLawText($revision, $is_raw));
 }