【问题标题】:How Use @can with @paginate together in Laravel lighthouse如何在 Laravel 灯塔中同时使用 @can 和 @paginate
【发布时间】:2022-08-04 16:47:14
【问题描述】:

当我在获取所有用户的查询中使用@can 时,如下所示:

getUsers(
      first_name: String @like(template : \"%{}%\") 
      last_name: String @like(template : \"%{}%\")
      email: String @like(template : \"%{}%\")      
      group_id: Int  
      # group_id: Group  @belongsToMany(relation: \"groups\" ) 
      orderBy: [OrderByClause!] @orderBy
       ): [User]  @guard(with:[\"api\"]) @can(ability: \"getAllUser\") @paginate(builder: \"App\\\\GraphQL\\\\Queries\\\\User\\\\GetUsers@resolveUser\") 
   

并得到这个错误:

\"debugMessage\": \"Failed to find class UserPaginator in namespaces [App, App\\\\Models] for directive @can.\",

  • 你在最新版本的灯塔上吗?我试图重现这一点,但不能。

标签: graphql pagination directive lighthouse laravel-lighthouse


【解决方案1】:

这已在 Lighthouse v5.45.3 中修复 https://github.com/nuwave/lighthouse/releases/tag/v5.45.3

因此,您只需更新 Lighthouse 即可解决您的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2019-08-22
    • 2021-10-02
    • 2021-09-10
    • 2021-11-20
    • 1970-01-01
    • 2021-09-13
    • 2021-12-26
    相关资源
    最近更新 更多