【问题标题】:Laravel Jetstream Route Test With Inertia Returns Error Code 500带有惯性的 Laravel Jetstream 路线测试返回错误代码 500
【发布时间】:2021-01-13 07:17:15
【问题描述】:

测试它可以工作,我可以访问该页面并且控制器工作正常。我写了以下测试:

public function test_logged_user_is_not_redirected()
{
    PartnerFactory::new()->create();

    $request = $this->actingAs(UserFactory::new()->create())
        ->get('partners')
        ->assertRedirect('partners');

    dd($request->inertiaProps());
}

我收到错误代码 500。这是控制器:

public function index()
{
    return Inertia::render('Partners/Index', [
        'filters' => \Illuminate\Support\Facades\Request::all($this->getFilters()),
        'contacts' => function() {
            return $this->getAllContacts();
        }
    ]);
}

这是web.php中的路由

Route::get('partners', [PartnersController::class, 'index'])
->name('partners')
->middleware('auth');

使用刷新数据库,之前尝试了带有'/'的url,我仍然得到500。

编辑:没有异常处理我得到:尝试获取非对象的属性“id”

【问题讨论】:

    标签: laravel routes inertiajs jetstream


    【解决方案1】:

    找到解决方案:jetstream 中的用户必须拥有个人团队!

    【讨论】:

      猜你喜欢
      • 2021-06-26
      • 2021-06-30
      • 2021-04-09
      • 2017-11-13
      • 2020-12-09
      • 2015-05-27
      • 1970-01-01
      • 2019-09-01
      • 1970-01-01
      相关资源
      最近更新 更多