Skip to content

Commit

Permalink
[7.x] Add alias as key of package's view components (#32863)
Browse files Browse the repository at this point in the history
* add alias as key of package's view components

* add alias as key of package's view components

* Update ServiceProvider.php

Co-authored-by: Cao Minh Duc <devs@Caos-MacPro.local>
Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
3 people authored May 18, 2020
1 parent 58b9e37 commit c66fcc3
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Illuminate/Support/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ protected function loadViewsFrom($path, $namespace)
protected function loadViewComponentsAs($prefix, array $components)
{
$this->callAfterResolving(BladeCompiler::class, function ($blade) use ($prefix, $components) {
foreach ($components as $component) {
$blade->component($component, null, $prefix);
foreach ($components as $alias => $component) {
$blade->component($component, is_string($alias) ? $alias : null, $prefix);
}
});
}
Expand Down

0 comments on commit c66fcc3

Please sign in to comment.