我正在尝试使用 Kong 的 oauth2 授权插件在顶部 kong 上添加一个 API。我按照他们的Kong 文档遵循的步骤:
我从上述步骤中获得了 client_id、client_secret、provision_key 等,但我想知道是否需要在我的一端创建 oauth2 服务器或 kong 本身在他们的一端配置它,我们只需要调用他们的端点。我正在 Laravel 中构建我的 API。
我试图通过使用"使用"给了别名,模型类的名称使用在laravel雄辩的方法相关模型的类名.例如,我使用过UserProfile模型类:
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use App\Models\UserProfile;
Run Code Online (Sandbox Code Playgroud)
而现在我正在以雄辩的方式使用它,如下所示:
public function profileDetails() {
return $this->hasOne('UserProfile', 'user_id', 'id');
}
Run Code Online (Sandbox Code Playgroud)
但这会引发一个错误.Class 'UserProfile' not found
如果我直接在这个雄辩的第一个参数中传递相关模型的名称和路径,那么它的工作正常
public function profileDetails() {
return $this->hasOne('App\Models\UserProfile', 'user_id', 'id');
}
Run Code Online (Sandbox Code Playgroud)
我想知道为什么它没有合作 use