Today I released Laravel 7.9.0. This release includes two improvements for Blade components.
First, the release fixes a developer experience issue when using Blade components in combination with Laravel Livewire. Previously, specifying a wire:click attribute on a component that utilizes an in-scope PHP variable was very cumbersome since it required binding the attribute as a raw PHP expression:
<x-button :wire:click="'selectPlan(\''.$plan['id'].'\')" />
Beginning in Laravel 7.9.0, you may use the more expected Blade echo syntax:
<x-button wire:click="selectPlan('{{ $plan['id'] }}')">
In previous releases of Laravel 7.x, any public component methods that did not require any arguments could be access as variables. For example, imagine a component that has a public countries method to retrieve a list of countries. This method's results could be access like so:
{{ $countries }}
This was unintuitive behavior and inconsistent behavior since developers naturally try to invoke the variable. Beginning in Laravel 7.9.0, public component methods that do not require arguments can be accessed as a variable or by invoking the variable as a callable:
{{ $countries() }}
Here’s what we've been up to recently.
Certified Quality. Great Prices