Livewire3のrenderのview関数でエラーが出る
Livewire3のrenderのview関数で、下記のような感じでlayoutやtitleを使うと、エラーが出ます。
public function render(){ return view('livewire.pages.toppage') ->layout('components.layouts.main') ->title($this->pageTitle);}エラー
Undefined method 'layout'.intelephense(P1013)エディタでエラーになるのですが、実際的には問題なく動作しています。 つまり実際はエラーではないので、エラーが表示されないようにしたいです。
こちらに解決策が載っていました。
https://github.com/bmewburn/vscode-intelephense/issues/2079 — github.com
プロジェクトのルートに、intelephense_helper.php というファイルを作成して、中身を下記にします。
<?php
namespace Illuminate\Contracts\View;
use Illuminate\Contracts\Support\Renderable;
interface View extends Renderable{ /** @return static */ public function extends(); public function layoutData(); public function layout(); public function title();}これでエラーがで消えました。