<?php
namespace App\View\Components;
use Illuminate\View\Component;
class Thumb extends Component
{
public function render()
{
return view('components.img.view', []);
}
}
When the class is extending Component it can be assumed that the view will be included in a context where the following variables exists as as such we should inject them when evaluating it out of context to pass the template correctly.
$slot = new Illuminate\Support\HtmlString();
$attributes = new Illuminate\View\ComponentAttributeBag();
If detecting the context of view() is problematic we could require that Component::view() be used instead.
When the class is extending
Component
it can be assumed that the view will be included in a context where the following variables exists as as such we should inject them when evaluating it out of context to pass the template correctly.If detecting the context of
view()
is problematic we could require thatComponent::view()
be used instead.