Пример #1
0
 /**
  * @param string $view
  * @param array  $data
  *
  * @return string
  */
 public function render($view = NULL, array $data = []) : string
 {
     // merge existing scope with provided data array
     $this->merge($data);
     if (NULL === $view) {
         $view = $this->template;
     }
     // one way or the other, there must be a template to render
     if (NULL === $view) {
         throw new \InvalidArgumentException('No view template supplied.');
     }
     $path = $this->context->finder()->find($view);
     $blade_view = new View($this->context->factory(), $this->context->engine(), NULL, $path, $this->context->toArray());
     return $blade_view->render();
 }
Пример #2
0
 /**
  * **Make a new View.**
  *
  * Note: __This method is used internally to make views.__
  *
  * The purpose for this is to allow making changes to the View
  * object before rendering. ie:
  *
  *      $view = app('blade.view')->makeView('test',['data'=>'some data']);
  *      $view->nest('key','view',['test' => 'test data']);
  *      return $view->render();
  *
  * @param       $view
  * @param array $data
  *
  * @return View
  */
 public function makeView($view, array $data)
 {
     $data = parent::collectScope($data);
     return $this->context->factory()->make($view, $data);
 }