以前,data_get 帮助器可用于检索数组和 Collection 实例上的嵌套数据;然而,这个助手现在可以检索所有可迭代对象的嵌套数据。<code>str</code> 助手函数影响的可能性:非常低Laravel 9.x 现在包含一个全局 str helper function。 如果你在你的应用程序中定义了一个全局的 str 助手,你应该重命名或删除它,这样它就不...
Laravel 队列为各种不同的队列驱动提供统一的队列 API,例如 Amazon SQS,Redis,甚至关系数据库。Laravel 队列的配置选项存储在 config/queue.php 文件中。 在这个文件中,你可以找到框架中包含的每个队列驱动的连接配置,包括数据库, Amazon SQS, Redis,和 Beanstalkd 驱动,以及一个会立即执行作业的同步驱动(用于本地...
If you would like to add additional fields to the validated data, you may call the merge method:$validated = $request->safe()->merge(['name' => 'Taylor Otwell']); If you would like to retrieve the validated data as a collection instance, you may call the collect method:...
If you would like to add additional fields to the validated data, you may call the merge method:1$validated = $request->safe()->merge(['name' => 'Taylor Otwell']);If you would like to retrieve the validated data as a collection instance, you may call the collect method:...
If you're new to modern PHP development, Laracasts is a no-brainer. When I landed my first API project, Laracasts quickly gave me the tools I needed to understand Laravel and build a solid app. There's nothing else like it! G. M. Henderson ...
2use Illuminate\Support\Collection; 3 4/** 5 * Execute the job. 6 */ 7public function handle(): void 8{ 9 if ($this->batch()->cancelled()) { 10 return; 11 } 12 13 $this->batch()->add(Collection::times(1000, function () { 14 return new ImportContacts; 15 })); 16}Yo...
IntroductionLaravel provides a very fluent API for making HTTP requests to your application and examining the responses. For example, take a look at the feature test defined below:<?phpnamespace Tests\Feature;use Illuminate\Foundation\Testing\RefreshDatabase;...
In case you are planning to operate sensitive data like passwords, API keys and so on, you may want to store them as an encrypted strings rather than the plain ones. This can be achieved enabling \Illuminatech\Config\Item::$encrypt. For example:<?php use Illuminate\Config\Repository; use...
Tracker::trackEvent(['name' => 'cart.add']); Tracker::trackEvent(['name' => 'cart.add', 'object' => 'App\Cart\Events\Add']); ###Routes Tracker::trackVisit( [ 'name' => 'my.dynamic.route.name', 'action' => 'MyDynamic@url' ], ['path' => 'my/dynamic/url'] ); Requirem...
In the previous episode, we used the query builder to fetch the relevant post from the database. However, there's a second option we should consider: Eloquent. Not only does an Eloquent class provide the same clean API for querying your database, but it's also the perfect place to store...