Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 2 additions & 6 deletions src/Illuminate/Database/Eloquent/Concerns/HidesAttributes.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ public function makeVisible($attributes)
*/
public function makeVisibleIf($condition, $attributes)
{
$condition = $condition instanceof Closure ? $condition($this) : $condition;

return $condition ? $this->makeVisible($attributes) : $this;
return value($condition, $this) ? $this->makeVisible($attributes) : $this;
}

/**
Expand All @@ -123,8 +121,6 @@ public function makeHidden($attributes)
*/
public function makeHiddenIf($condition, $attributes)
{
$condition = $condition instanceof Closure ? $condition($this) : $condition;

return value($condition) ? $this->makeHidden($attributes) : $this;
return value($condition, $this) ? $this->makeHidden($attributes) : $this;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Illuminate\Foundation\Testing\Concerns;

use Closure;
use Illuminate\Support\Facades\View as ViewFacade;
use Illuminate\Support\MessageBag;
use Illuminate\Support\Str;
Expand Down Expand Up @@ -57,11 +56,7 @@ protected function component(string $componentClass, array $data = [])
{
$component = $this->app->make($componentClass, $data);

$view = $component->resolveView();

if ($view instanceof Closure) {
$view = $view($data);
}
$view = value($component->resolveView(), $data);

return $view instanceof View
? new TestView($view->with($component->data()))
Expand Down
2 changes: 1 addition & 1 deletion src/Illuminate/Foundation/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ function rescue(callable $callback, $rescue = null, $report = true)
report($e);
}

return $rescue instanceof Closure ? $rescue($e) : $rescue;
return value($rescue, $e);
}
}
}
Expand Down
8 changes: 2 additions & 6 deletions src/Illuminate/View/Concerns/ManagesComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace Illuminate\View\Concerns;

use Closure;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Contracts\View\View;
use Illuminate\Support\Arr;
Expand Down Expand Up @@ -84,9 +83,7 @@ public function renderComponent()

$data = $this->componentData();

if ($view instanceof Closure) {
$view = $view($data);
}
$view = value($view, $data);

if ($view instanceof View) {
return $view->with($data)->render();
Expand Down Expand Up @@ -151,8 +148,7 @@ public function endSlot()
$this->slotStack[$this->currentComponent()]
);

$this->slots[$this->currentComponent()]
[$currentSlot] = new HtmlString(trim(ob_get_clean()));
$this->slots[$this->currentComponent()][$currentSlot] = new HtmlString(trim(ob_get_clean()));
}

/**
Expand Down