每当我运行 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) 我有一种在创建时存储员工数据的方法,但是我定义了一个随机创建和散列的默认密码。由于某种原因未存储密码。
有任何想法吗?
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)