laravel-http-client 相关问题


Laravel webhook 客户端在 Whatsapp Webhook url 上出现错误 405

我尝试在whatsapp云中使用laravel进行webhook,但它显示此错误 脸书错误 并在 ngrok 中显示此错误 恩格罗克错误 我使用 https://github.com/spatie/laravel-webhook-client


如何在 Laravel Blade 视图中返回错误/成功消息?

发送请求的URL是: http://localhost:8000/my_details?my_id='.$id 我的控制器看起来像这样: 公共函数my_action(请求$请求){ $myauth=$请求->验证([ ...


自省端点验证同一客户端和其他客户端颁发的令牌

我正在使用符合 OAuth 2.1 的授权服务。 有两个 oauth2 客户端“client-1”、“client-2” 使用“client-1”创建访问令牌 反省将军...


Laravel 中的策略对我不起作用,这是我的代码

我无法让策略在我的 Laravel 项目中工作,我安装了一个新项目来从头开始测试,我有这个控制器: 我无法让策略在我的 Laravel 项目中工作,我安装了一个新项目来从头开始测试,我有这个控制器: <?php namespace App\Http\Controllers; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use App\Models\User; class UserController extends Controller { public function index() { $this->authorize('viewAny', auth()->user()); return response("Hello world"); } } 本政策: <?php namespace App\Policies; use Illuminate\Auth\Access\Response; use App\Models\User; class UserPolicy { public function viewAny(User $user): bool { return true; } } 这是我的模型 <?php namespace App\Models; // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, HasFactory, Notifiable; /** * The attributes that are mass assignable. * * @var array<int, string> */ protected $fillable = [ 'name', 'email', 'password', ]; /** * The attributes that should be hidden for serialization. * * @var array<int, string> */ protected $hidden = [ 'password', 'remember_token', ]; /** * The attributes that should be cast. * * @var array<string, string> */ protected $casts = [ 'email_verified_at' => 'datetime', 'password' => 'hashed', ]; } 我收到错误 403:此操作未经授权。我希望有人能帮助我解决我的问题。谢谢你 我也尝试过修改AuthServiceProvider文件,但没有任何改变。 必须在 App\Providers\AuthServiceProvider 中添加您的策略吗? protected $policies = [ User::class => UserPolicy::class ]; 您需要指定您正在使用的模型。具体来说,就是User。因此,传递当前登录的用户: $this->authorize('viewAny', auth()->user()); 此外,您正在尝试验证用户是否有权访问该页面。确保尝试访问该页面的人是用户,以便策略可以授权或不授权。 要在没有入门套件的情况下进行测试,请创建一个用户并使用它登录。 <?php namespace App\Http\Controllers; use Illuminate\Support\Facades\Auth; class UserController extends Controller { public function index() { $user = \App\Models\User::factory()->create(); Auth::login($user); $this->authorize('viewAny', auth()->user()); return response("Hello world"); } } 但是,如果您希望授予访客用户访问权限,您可以使用 ? 符号将 User 模型设为可选: public function viewAny(?User $user) { return true; }


我正在使用 laravel livewire 3 获取页面未找到

单击时,我在控制台中找不到页面 错误:POST http://localhost/livewire/update 404(未找到) counter.blade.php {{ $this->count }} 单击时,我在控制台中找不到页面 错误:POST http://localhost/livewire/update 404(未找到) counter.blade.php <div> <h1>{{ $this->count }}</h1> <button wire:click="increment">+</button> <button wire:click="decrement">-</button> </div> 在刀片中我有以下内容: @section('custom-js') @livewireScripts @endsection @section('custom-css') @livewireStyles @endsection <livewire:counter /> 当单击增量或减量时,我找不到页面 如果您使用Livewire3,则无需手动注入livewire资源的css和javascript,因为它们是自动注入的。 检查此文档页面以查看。 您必须先创建 Livewire 组件 php artisan make:livewire CreatePost Livewire 组件的更新功能。 public function update(){...}


Laravel POST 方法返回状态:405 不允许在 POST 方法上使用方法

请查找以下信息: NoteController.php 请查找以下信息: NoteController.php <?php namespace App\Http\Controllers; use App\Http\Requests\NoteRequest; use App\Models\Note; use Illuminate\Http\JsonResponse; class NoteController extends Controller { public function index():JsonResponse { $notes = Note::all(); return response()->json($notes, 200); } public function store(NoteRequest $request):JsonResponse { $note = Note::create( $request->all() ); return response()->json([ 'success' => true, 'data' => $note ], 201); } public function show($id):JsonResponse { $note = Note::find($id); return response()->json($note, 200); } public function update(NoteRequest $request, $id):JsonResponse { $note = Note::find($id); $note->update($request->all()); return response()->json([ 'success' => true, 'data' => $note, ], 200); } public function destroy($id):JsonResponse { Note::find($id)->delete(); return response()->json([ 'success' => true ], 200); } } NoteRequest.php <?php namespace App\Http\Requests; use Illuminate\Foundation\Http\FormRequest; class NoteRequest extends FormRequest { public function authorize() { return true; } public function rules() { return [ 'title', 'required|max:255|min:3', 'content', 'nullable|max:255|min:10', ]; } } Note.php(模型) <?php namespace App\Models; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; class Note extends Model { use HasFactory; protected $guarded = []; } api.php <?php use App\Http\Controllers\NoteController; use Illuminate\Support\Facades\Route; Route::prefix('v1')->group(function () { Route::resource('/note', NoteController::class); }); php artisan 路线:列表 GET|HEAD / ...................................................................................................................... POST _ignition/execute-solution ............... ignition.executeSolution › Spatie\LaravelIgnition › ExecuteSolutionController GET|HEAD _ignition/health-check ........................... ignition.healthCheck › Spatie\LaravelIgnition › HealthCheckController POST _ignition/update-config ........................ ignition.updateConfig › Spatie\LaravelIgnition › UpdateConfigController GET|HEAD api/v1/note .......................................................................... note.index › NoteController@index POST api/v1/note .......................................................................... note.store › NoteController@store GET|HEAD api/v1/note/create ................................................................. note.create › NoteController@create GET|HEAD api/v1/note/{note} ..................................................................... note.show › NoteController@show PUT|PATCH api/v1/note/{note} ................................................................. note.update › NoteController@update DELETE api/v1/note/{note} ............................................................... note.destroy › NoteController@destroy GET|HEAD api/v1/note/{note}/edit ................................................................ note.edit › NoteController@edit GET|HEAD sanctum/csrf-cookie .................................. sanctum.csrf-cookie › Laravel\Sanctum › CsrfCookieController@show 迅雷请求(同邮递员) JSON 请求 { "title": "Hello World", "content": "Lorem ipsum." } 尝试发出 JSON POST 请求并获取状态:405 方法不允许并且我正在使用 php artisan 服务,如果需要,我可以提供 GIT 项目。请告诉我。 您的验证规则看起来不正确。在您的 NoteRequest 类中,规则应该是一个关联数组,其中键是字段名称,值是验证规则。但是,在您的代码中,规则被定义为以逗号分隔的字符串列表。这可能会导致验证失败并返回 405 Method Not allowed 错误。 public function rules() { return [ 'title' => 'required|max:255|min:3', 'content' => 'nullable|max:255|min:10', ]; }


使用Vite JS导入带变量的图片

我目前在 client\src\pages\Dashboard.jsx 工作 我有一个文件 client\src ssets rog_photos ,其中包含 200 张随机图像,我一直在尝试使用变量导入图像并显示...


如何在 laravel 10 中使用 Laravel-mix

似乎无法配置 laravel-mix 包。 嘿,我想在 laravel 10 中使用 laravel-mix 包,但我似乎无法正确配置它,因为当我运行 npx mix 时,我不断收到错误...


使用 Nodejs18 运行时将 `@aws-sdk/client-bedrock-runtime` 导入 AWS Lambda 函数

我正在尝试使用 NodeJs18 运行时将 @aws-sdk/client-bedrock-runtime 导入到 AWS Lambda 函数中。 该软件包应该可用,因为根据 AWS 文档,“对于 Node.js 版本......


使用 @aws-sdk/client-sqs npm 包从 EKS 集群 pod 推送到 AWS SQS 时出错

我在 AWS EKS 集群中使用 @aws/client-sqs npm 包将消息推送到标准 SQS 队列并收到以下错误: CredentialsProviderError:169.254.170.23 不是有效的容器我...


自定义骑行存在(discord.js v14)

const 猫鼬 = require("猫鼬") 需要(“dotenv”).config() const {Client,ActivityType} = require("discord.js") 模块. 导出 = { 名称:'准备好', /** ...


AWS/S3/boto3:无法使用 presigned_url 将文件上传到存储桶

我有以下代码来获取 presigned_url: s3_client = boto3.client('s3', endpoint_url=AWS_ENDPOINT) presigned_url = s3_client.generate_presigned_url('get_object', ...


“client”未定义,client.completions.create

进口遥控机器人 导入openai 机器人 = telebot.TeleBot("0") openai.api_key = "0" @bot.message_handler(content_types=['text']) def lalala(消息): 打印(消息.聊天.标题,


Laravel Inertia VueJs 的本地化

我正在尝试在 Laravel Inerita (Vue.js) 上设置本地化。我知道 https://github.com/mcamara/laravel-localization,但这不支持 Inertia(至少我没有成功


Composer 版本匹配错误 laravel + spatie medialibrary

我尝试通过 laravel 安装程序使用 laravel new 创建一个新的 laravel 应用程序。 这工作没有问题。当我尝试安装 spatie/medialibrary 时,我收到以下错误...


如何创建松果客户端,它给出错误

存在于松果.ts 中 从 '@pinecone-database/pinecone' 导入 { PineconeClient } 导出 const getPineconeClient = async () => { const client = new PineconeClient() 等待客户。


为什么在silent_renew.html(oidc-client)上没有更新令牌

我的应用程序中有以下 AuthProvider: 从 'oidc-react' 导入 { AuthProvider, AuthProviderProps }; const AuthWrapper = ({ 孩子 }: { 孩子: React.ReactNode }) => { 常量调度...


onSuccess 回调是否已从查询(tRPC)中删除?

app/auth-callback/page.tsx 从 'next/navigation' 导入 { useRouter, useSearchParams } 从“反应”导入反应 从 '../_trpc/client' 导入 { trpc } 常量页面 = () => { 常量路由器 =


Kafka Java Consumer Client 是单线程的吗

我们正在开始使用 Kafka, 在阅读本文时 - https://docs.confluence.io/kafka-clients/java/current/overview.html - 它似乎暗示客户端是单线程的。 * 由于这个...


HubspotClient - 通过电子邮件 ID 更新联系人不起作用

在 NodeJS 中,我使用的是“@hubspot/api-client”:“^7.1.2”。 使用accessToken创建hubspot客户端如下 const hubSpotClient = new hubspot.Client({ accessToken }); 当我尝试


SAS/WPS HTTP PROC 基本身份验证

我尝试使用 WPS 从 JIRA REST API 获取数据。我使用 HTTP PROC 调用 JIRA Rest api。 过程http 方法=“获取” url =“http://服务器名称:8080/rest/api/2/search?%str(&)fields=pro...


Laravel 路由添加模板名称

我有一个名为 Lodge.upload 的刀片模板。在该模板中,我有以下代码: 我有一个名为 Lodge.upload 的刀片模板。在该模板中,我有以下代码: <form name="app" action="storeSummons" enctype="multipart/form-data" method="post"> 在我的路线文件中我有这个: Route::post('/storeSummons',[\App\Http\Controllers\LodgesController::class,'storeSummons'])->name('storeSummons'); 当我尝试从这个简单的表单(只有两个字段)发布时,我收到错误 Lodge.uploads/storeSummons 路由不支持 POST 方法。支持的方法:GET、HEAD 该路线明确标记为 storeSummons,没有提及模板名称或其路线。 我已经尝试清除缓存、路由、视图,但它仍然坚持将其添加到路由中。该组仅具有添加中间件的身份验证。 这让我发疯,我检查了路线是否被重复但没有成功。 我将协助您解决 Laravel 应用程序中的“不支持 POST 方法”错误。以下是综合的回应,结合了专家反馈的见解并解决了潜在的原因: 理解错误: 不正确的路线或方法:该错误表明两者之间不匹配 表单的提交方法和定义的路线。 缺少 CSRF 令牌:Laravel 需要有效的 CSRF 令牌才能进行 POST 请求以防止跨站点请求伪造攻击。 故障排除步骤: 验证路线定义: 确保路由定义为 POST 路由: Route::post('/storeSummons', ...)。 检查是否有任何具有相同路径或名称的冲突路由。 如果路由在组内,请确认该组的中间件 配置。 包含 CSRF 代币: 在表单中添加 @csrf 指令: <form name="app" action="storeSummons" enctype="multipart/form-data" method="post">@csrf</form> 检查路由缓存: 清除路由缓存:php artisan route:clear。 如果使用缓存机制,也清除那里的缓存。 回顾中间件: 检查应用于路由或组的中间件,确保它们不会干扰 - POST 请求。 检查浏览器开发者工具: 检查网络请求的路径和方法是否正确。 查找任何指示问题的错误或警告。


Laravel 10 Vite“npm run build”创建空文件

由于某种原因,运行该命令时,某些脚本会编译,而某些脚本的内容会被“删除”。这是我的 vite.config.js 文件: 从“laravel-vite-plugin”导入 laravel; 导入vu...


通过clickhouse命令行连接到远程clickhouse数据库

当我尝试通过clickhouse命令行连接到远程clickhouse数据库时: $ clickhouse-client -h some_ip.com --端口 8123 -u some_user --password some_password -d some_db 我得到: ClickHouse c...


Cloudfoundry Laravel“无法打开输入文件:artisan”

我正在尝试使用 CF CLI 推送 Laravel 应用程序。 我创建了一个新的 Laravel 应用程序(manifest.yml)并尝试部署它,但收到错误“无法打开输入文件:artisan”...


如何在 Laravel 项目中使用 DD() 方法?

我需要知道如何在 Laravel 项目中正确使用 dd() 函数。 例如 - 我有任务来调试我的项目(PHP /Laravel)中的一些代码和功能,这总是需要我


Inertia.js 和 Laravel - 视图如何自动接收 auth::user() 对象?

我目前正在开发 Laravel 8 项目,第一次尝试将提供的 Laravel Breeze 脚手架与 Inertia.js 和 Vue 一起使用。在最初的仪表板脚手架中,仪表板...


Golang elasticsearch TypedClient 聚合如何循环结果

我正在使用 Elastic 的官方 Elasticsearch Go Typed Client 包来查询 uniq 服务名称,为此我构建了一个聚合搜索。查询成功,响应包含Bu...


禁用 Laravel 调试器

我有一个不是我开发的 Laravel 应用程序。每个页面的底部都有一些奇怪的栏,它是某种类型的 Laravel 调试器工具。 我相信它存储在存储/调试器中。是


Laravel 9 突变冒号

在 Laravel 9 中,变异器有不同的实现。以下示例来自官方文档。 受保护函数firstName():属性 { 返回属性::make( ...


将 Laravel 的 .env 文件复制到 Docker 容器中

设置 我正在 Ubuntu 服务器上运行 Docker,并尝试创建一个 Laravel 容器来使用 artisan 运行我的网站。 Laravel 项目位于 GitHub 存储库内,我将该项目克隆到...


Laravel Passport 登录无法使用 Jetstream Inertia 正确重定向

我已经用 Laravel Passport 实现了一个 OAuth 系统,但是该系统的登录和所有身份验证都是由 Laravel Jetstream 和 Inertia 处理的。 当我想请求代码时(使用


React Vite + SockJS 客户端全部传输失败

我的项目使用react + vite,没有任何代理配置 我尝试使用 webstomp-client 和 sockjs 连接到 websocket 服务器(Springboot 支持 SockJS) 后端springboot服务器生成...


driver.startActivity()函数有替代方法吗?

我正在使用Appium 2.2.3、Java JDK 17.05、Appium Java Client 9.0.0、TestNG 7.8.0。我正在尝试运行下面的代码并收到 java 空指针异常。试图寻找替代方案 活动...


在哪里使用 dd() 函数来调试 Laravel 应用程序?

我需要知道如何在 Laravel 项目中正确使用 dd() 函数。 例如 - 我有任务来调试我的项目(PHP /Laravel)中的一些代码和功能,这总是需要我


Feign 客户端抛出 DNS 名称未知主机异常

我已经创建了 Spring boot 应用程序并使用 REST API 开发并部署在具有 DNS 名称的其他服务器上。 @FeignClient(url="${env.app.crm.url}", value=“crm-feign-client...


在nest.js中配置sftp

我正在尝试使用此节点包 ssh2-sftp-client 在 Nest.js 中配置 sftp 服务器。但是我收到错误 ssh2_sftp_client_1.SftpClient 不是构造函数。 这就是我到目前为止所做的 t...


错误:cvc-elt.1.a:找不到元素“beans”的声明

添加此代码时,出现此错误,我尝试将 beans:beans 添加到标记中,但随后出现相同的错误,请帮我解决此问题 添加此代码时,出现此错误,我尝试将 beans:beans 添加到标签中,但随后出现相同的错误,请帮我解决这个问题 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <bean id="testBean" class="alishev.spring.demo.TestBean"> <constructor-arg value="Neil"/> </bean> </beans> 您拥有 xmlns:beans="http://www.springframework.org/schema/beans",这意味着您需要为该命名空间中的所有标签添加前缀 beans:。 从 :beans 中删除 xmlns:beans="http://www.springframework.org/schema/beans",这样您的 XML 应如下所示 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <bean id="testBean" class="alishev.spring.demo.TestBean"> <constructor-arg value="Neil"/> </bean> </beans>


Laravel 测试assertSessionDoesntHaveErrors() 没有发现错误?

我想在 Laravel 测试中断言两件事: 对象已成功更改(例如,assertSee('New value')) 会话中没有错误(例如,assertSessionDoesntHaveErrors())


尝试通过websocket和client-go与k8s容器交互

当我尝试与k8s容器交互时,我发现我无法获取容器结果,而是获取我输入的内容。哪里有问题? func ExecCommandInPod(ctx context.Context, conn *websocket2.


为什么我的存储桶名称位于 R2 对象的键中?

我在无服务器函数中使用 Cloudflare R2 和 @aws-sdk/client-s3。 在这里,我尝试将一个对象添加到我的存储桶('my-bucket'); 从“@aws-sdk/


部署后的 Laravel 护照

我在 aws ec2 实例上运行 laravel 应用程序,并使用 laravel 护照通过不记名令牌来保护我的 api。 每次部署后,护照密钥都消失了,所以我在...之后添加了护照:安装命令


react-native(博览会)中的输入无法在网络上打开(混合应用程序)

我正在使用react-native(expo)创建一个应用程序混合体,以及一些类似的库: ` “依赖项”:{ "@apollo/client": "^3.8.4", “@gluestack-style/react&q...


Dockerfile 无法使用 Prisma 访问 docker-compose postgresql 数据库 url

我真的不知道为什么,但我的 Dockerfile 映像无法访问使用 docker compose 运行的 postgres 数据库 // prisma.schema 生成器客户端{ 提供者=“prisma-client-js” } 数据源...


未定义的变量:Laravel 8 上的 __env

这是我的代码: @foreach($comments->where("id_answered_comment", null) as $comment) @php


APN PHP 代码给出警告:stream_socket_client() [function.stream-socket-client]: 无法连接到 ssl://gateway.sandbox.push.apple.com:2195

我正在尝试使用 PHP 代码实现 Apple 推送通知。这是我的代码: $deviceToken = '我的设备令牌'; $密码=''; $message = '我的第一个推送通知!'; //////////////////...


Vite-Vue 应用 HTTP 请求重定向 - DEV 模式

我想在开发模式(npm)上将 HTTP 请求的基本 URL 从 Vite 应用程序的主机地址(http://localhost:5173)更改为我的 ASP .NET API 的主机地址(http://localhost:5815)运行开发)。 但我有这样的


如何在 vitest 中测试 laravel sainttum 路线

我有一个应用程序,使用 Vue 框架作为客户端,使用 laravel 框架作为服务器。 我的身份验证是通过 laravel sainttum 完成的,这是一个基于 cookie 的身份验证系统。 我当前的设置...


设置中间件以接受字符串或 null

我正在尝试在 Laravel Inerita (Vue.js) 上设置本地化。我知道 https://github.com/mcamara/laravel-localization,但这不支持 Inertia(至少我没有成功


在 Node.js 中使用谷歌地图距离矩阵 api 时出现错误:“o.map 不是函数”

我正在使用 Google Maps API 节点客户端并调用 distancematrix 函数,但收到一条错误消息,提示 o.map 不是函数。 const {Client} = require("@googlemaps/google-maps-


© www.soinside.com 2019 - 2024. All rights reserved.