我开发了一个包,在渲染普通视图时,它工作得很好,但现在我想渲染整页 Livewire 组件,我得到一个“未找到视图消息”,知道为什么吗?
例如演出门票视图:
web.php:
Route::get('tickets/list', ShowTickets::class);
服务提供商:
public function boot()
{
$this->loadMigrationsFrom(__DIR__ . "/database/migrations");
$this->loadRoutesFrom(__DIR__ . "/routes/web.php");
$this->loadViewsFrom(__DIR__ .'/resources/views', "Tickets");
Livewire::component('show-tickets', ShowTickets::class);
}
ShowTickets.php :
<?php
namespace UHGroup\Tickets\App\Livewire;
use Livewire\Component;
use UHGroup\Tickets\App\Models\Ticket;
class ShowTickets extends Component
{
public function mount()
{
$this->ticket = Ticket::where("archived_at", !null);
}
public function render()
{
$tickets = Ticket::all();
return view('Tickets::livewire.show-tickets', compact('tickets'));
}
}
我收到以下错误:
未找到查看 [livewire.show-tickets]。
尽管我的视图文件夹中的 livewire 文件夹中确实有一个 show-tickets.blade.php 文件....
确保您已在
config/app.php
? 中正确添加服务提供商