在 laravel 6 中,密码代理现在有以下限制密码重置(https://github.com/laravel/framework/blob/6.x/src/Illuminate/Auth/Passwords/PasswordBroker.php#L58)
public function sendResetLink(array $credentials)
{
    // First we will check to see if we found a user at the given credentials and
    // if we did not we will redirect back to this current URI with a piece of
    // "flash" data in the session to indicate to the developers the errors.
    $user = $this->getUser($credentials);
    if (is_null($user)) {
        return static::INVALID_USER;
    }
    if (method_exists($this->tokens, 'recentlyCreatedToken') &&
        $this->tokens->recentlyCreatedToken($user)) {
        return static::RESET_THROTTLED;
    }
    // Once we have …我从5.4 开始就一直在研究 Laravel 框架
这是 Laravel 版本和错误处理程序的历史
并且随着Laravel 6.0 的发布,他们引入了名为Ignition的新错误页面
https://github.com/facade/ignition
这个包内置了高级调试。但显然这是由VueJS完成的。
所以在 Postman 中调试 Api 请求时,我没有在预览中得到任何东西。
那么有没有办法在 Laravel 6.0 和未来版本中切换到 Whoops。
因为即使在旧版本的 Laravel 项目中也有切换到 Ignition 的选项
使用下面的代码 app/Exceptions/Handler.php
protected function whoopsHandler()
{
    try {
        return app(\Whoops\Handler\HandlerInterface::class);
    } catch (\Illuminate\Contracts\Container\BindingResolutionException $e) {
        return parent::whoopsHandler();
    }
}
我在 Laravel 中创建了一个带有标准日期时间列的表:
Schema::create('lists', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->string('name');
    $table->string('ref');
    $table->string('provider');
    $table->timestamps();
    $table->softDeletes();
    $table->unique(['provider', 'ref']);
});
当我尝试使用 Eloquent 创建一个简单的记录时:
List::updateOrCreate([
    'provider' => 'test',
    'ref'      => 'S4d3g'
], [
    'name' => 'Plan'
]);
我收到此消息(这是原始控制台输出,因此请忽略缺少引号):
SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2020-03-08 02:25:07' for column 'updated_at' at row 1 (SQL: insert into `lists` (`provider`, `ref`, `name`, `updated_at`, `created_at`) values (test, S4d3g, Plan, 2020-03-08 02:25:07, 2020-03-08 02:25:07))
在数据库上手动运行查询作为原始 SQL 也不起作用:
insert into `lists` (`provider`, `ref`, `name`, `updated_at`, `created_at`) values ('test', …我使用 Laravel 速率限制(节流)。我想知道它在哪里存储节流数据以及如何将默认存储系统更改为 MySQL/Mariadb 或 Redis?
I need to solve the following problem: I created two applications using Laravel.
https://test.example.org and provides a passport-instance and all user-data (Model: User). https://test.org and uses the API Application A provides using an "api-user" that exists in Application A to fetch "public" dataNow I would like to provide a login method for users of Application B. All users that are using Application B are existing …
我看过创建自己别名的文档,但它有点令人困惑。任何人都可以帮助我并简单地告诉我该怎么做吗?我认为它会帮助很多人,因为我在 stackoverflow 上看到的与此相关的问题很少,但真的很难得到。谢谢你。
我使用Laravel 6.7 和 Passport来使用我自己的 API。当我尝试使用 注销用户时Auth::logout(),出现以下错误:
Illuminate\Auth\RequestGuard::logout 不存在。
我不明白为什么我会有这样的行为。我没有使用任何定制的守卫。根据 Passport 设置,我的Auth.php如下:
<?php
return [
    'defaults' => [
        'guard' => 'web',
        'passwords' => 'users',
    ],
    'guards' => [
        'web' => [
            'driver' => 'session',
            'provider' => 'users',
        ],
        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
    ],
这是我的 AuthenticationController.php 注销代码所在的位置:
/**
     * --------------------------------------------------
     * Removes the identity of a users login session.
     * --------------------------------------------------
     * @param Request $request
     * @return MessageResource
     * -------------------------------------------------- …我创建新的表单请求并将其用于所有 CRUD 操作
并用于$this->getMethod();检查请求之间的差异
然后我面临逻辑问题
更新方法中是否需要store 方法中需要的所有字段?
=> 这里的问题是 API 的消费者是否应该发送所有密钥对象来更新特定密钥
如果不应该,并且从 API 发送的键名与数据库表列名不同
=> 我不能使用,update($request()->all());因为键与列名不同,然后我需要循环所有请求键以忽略具有空值的键 - 也可以通过多检查来完成-
那么请问最好的做法是什么?
我使用 Postman 在 Laravel Api 中发送请求,并且返回一个空数组。而且我不知道为什么?
\n\n我的路线:
\n\nRoute::middleware('auth:api')->group( function () {\n\n    Route::resource('reservations', 'ReservationController');\n});\n我的预订控制器:
\n\n    <?php\n\nnamespace App\\Http\\Controllers;\n\nuse Illuminate\\Http\\Request;\nuse App\\Http\\Requests\\ReservationCreateRequest;\nuse App\\Repositories\\ReservationRepository;\nuse App\\Http\\Resources\\Reservation as ReservationResource;\n\nclass ReservationController extends BaseController\n{\n\n    protected $entrepriseRepository;\n\n    public function __construct(ReservationRepository $reservationRepository)\n    {\n        $this->reservationRepository = $reservationRepository;\n    }\n\n    /**\n     * Display the specified resource.\n     *\n     * @param  int  $id\n     * @return \\Illuminate\\Http\\Response\n     */\n    public function show($id)\n    {\n        $reservation = $this->reservationRepository->getById($id);\n\n        return $this->sendResponse(new ReservationResource($reservation), 'Reservation');\n    }\n\n    /**\n     * Update the specified resource in storage.\n     *\n     * @param  Illuminate\\Http\\Request $request\n …我一直在努力在我自己为 Laravel 开发的测试包中注册 vue 组件。我什至检查了 laravel\horizon 和其他一些软件包,但我不知道该怎么做。我正在关注Laravel 包开发
所以我的包在我的 Laravel 应用程序之外。我的包结构如下:
vendor
    packagename
        resources
            js
                components
                    examplecomponent.vue
                app.js
        AppServiceProvide.php
        package.json
        webpack.mix.js
对于 vue 组件来说,这只是 Laravel 的示例,对于 app.js 来说,基本上没有改变任何东西,因为它只是用于测试目的。我尝试使用“vendor:publish”命令将 vue 组件复制到 resources\js\compnents,它正在复制它,但仍未在 app.js 中注册。所以问题是在 Laravel 包或供应商中注册 vue 组件的最佳方式是什么?Laravel Horizon 包如何注册它的组件,我确实检查了 Laravel/horizon 的所有代码源,没有像“npm run”这样的命令或复制组件并将其添加到主应用程序中的某个位置,就像 npm 正在检查一样供应商文件在 laravel/horizon 中搜索 package.json 文件,然后注册组件。如果是这样,为什么我的 vue 组件没有注册。
laravel-6.2 ×10
laravel ×8
php ×4
laravel-6 ×2
throttling ×2
ajax ×1
api ×1
json ×1
laravel-5.8 ×1
mysql ×1
request ×1
vue.js ×1
whoops ×1