@cortez.connelly
To pass an array variable to a Laravel component, you can use the with
method when calling the component in your Blade view. Here's an example:
1
|
$arrayVariable = ['item1', 'item2', 'item3']; |
1
|
<x-component-name :arrayVariable="$arrayVariable" /> |
1 2 3 4 5 6 |
public $arrayVariable; public function __construct($arrayVariable) { $this->arrayVariable = $arrayVariable; } |
Now you can access the array variable $arrayVariable
in your component's Blade view or methods.