How to pass an Array from x-slot to layouts in Laravel blade template.
This is my layout file
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<!--wrapper-->
<div class="wrapper">
{{ do something to the Array $arr }}
{{ $slot }}
</div>
<!--end wrapper-->
</body>
</html>
below is my view file
<x-layout>
{{ $arr }} <!-- how to pass it to the layout file -->
<x-slot:arr> array here </x-slot:arr>
</x-layout>
My question is how to pass the $arr to the layout file
My question is how to pass the $arr to the layout file
2
Answers
Maybe you can try with: