Laravel - Blade Templates - Component Methods
In addition to public variables being available to your component template, any public methods on the component may be invoked. For example, imagine a component that has an isSelected
method:
/**
* Determine if the given option is the currently selected option.
*
* @param string $option
* @return bool
*/
public function isSelected($option)
{
return $option === $this->selected;
}
You may execute this method from your component template by invoking the variable matching the name of the method: