小编Jak*_*f19的帖子

PHP 运行 artisan 命令时出现弃用问题

每当我运行 artisan 命令时,我都会遇到这个问题。

我正在使用 Valet 和 PHP 8.1。我尝试过更改 PHP 版本,但仍然遇到此问题。

当我跑步时:

jakefeeley@Jakes-MBP marketing % php artisan plugin:install vojtasvoboda.twigextensions
Run Code Online (Sandbox Code Playgroud)

返回:

PHP Deprecated:  Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/jakefeeley/Sites/certhub/marketing/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231

Deprecated: Return type of Illuminate\Container\Container::offsetExists($key) should either be compatible with ArrayAccess::offsetExists(mixed $offset): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in /Users/jakefeeley/Sites/certhub/marketing/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 1231 …
Run Code Online (Sandbox Code Playgroud)

php composer-php octobercms

11
推荐指数
5
解决办法
9万
查看次数

Laravel - 创建时随机密码

我有一种在创建时存储员工数据的方法,但是我定义了一个随机创建和散列的默认密码。由于某种原因未存储密码。

有任何想法吗?

public function store(Request $request)
    {
        // get company
        $company = Auth::user()->companies()->first();

        // get and validate data
        $storeData = $request->validate([
            'firstname' => 'required',
            'lastname' => 'required',
            'email' => 'required|email',
            'phone' => 'required|numeric|digits:11'
        ]);

        // create employee with validated data
        $employee = $company->employees()->create(array_merge($storeData), [
            'password' => Hash::make(Str::random(40)),
        ]);

        return redirect('/employees/' . $employee->id )
            ->with('success', 'Employee successfully created');
    }
Run Code Online (Sandbox Code Playgroud)

laravel

0
推荐指数
1
解决办法
1013
查看次数

标签 统计

composer-php ×1

laravel ×1

octobercms ×1

php ×1