Skip to content

Commit f3068fe

Browse files
authored
Merge pull request #17 from lead-worker/patch-1
Update Factory.php
2 parents 9173476 + 88bb7c1 commit f3068fe

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

src/View/Factory.php

+10-6
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,17 @@ public function __construct(EngineResolver $engines, ViewFinderInterface $finder
4242
*/
4343
public function make($view, $data = [], $mergeData = [])
4444
{
45-
if (isset($this->aliases[$view])) {
46-
$view = $this->aliases[$view];
47-
}
48-
$path = $this->finder->find($view);
45+
$path = $this->finder->find(
46+
$view = $this->normalizeName($view)
47+
);
48+
49+
// Next, we will create the view instance and call the view creator for the view
50+
// which can set any data, etc. Then we will return the view instance back to
51+
// the caller for rendering or performing other view manipulations on this.
4952
$data = array_merge($mergeData, $this->parseData($data));
50-
$this->callCreator($view = new View($this, $this->getEngineFromPath($path), $view, $path, $data, $this->shortcode));
5153

52-
return $view;
54+
return tap($this->viewInstance($view, $path, $data), function ($view) {
55+
$this->callCreator($view);
56+
});
5357
}
5458
}

0 commit comments

Comments
 (0)