laravel 语法错误,意外的 ',',期待 ';'

laravel syntax error, enexpected ',' , expecting ';'

我试图解决这个问题,但不知道如何解决

public function render()
{
    return view('livewire.home')->extends('layouts.app')->section('content'),[
        'products' => Product::take(3)->get()
    ];

说是语法错误,

unexpected ',', expecting ';'

我是 Laravel 的新手,所以我无法编写正确的语法。请告诉我。

正如您在docs中看到的,要将变量传递给视图,您需要将方法中的第二个参数view()设置为数据数组。

public function render()
{
    return view('livewire.home', [
        'products' => Product::take(3)->get()
    ])->extends('layouts.app')->section('content');
}