This is a community collaborative translation of the article, has been translated, more information please click
Introduction to collaborative translation 。
Laravel 5.6
changelog
Log to improve
config/app.php
config/logging.php
You can specify multiple processors to send log messages by configuring channels to “stack”. For example, you can send all debug messages to the system log and send error logs to Slack.
logging documentation
0
retranslation
View the other version
Single server task scheduling
onOneServer()
$schedule->command('report:generate')
->fridays()
->at('17:00')
->onOneServer();
Copy the code
memcached
redis
Dynamic access restriction
Dynamic access restriction
Route::middleware('auth:api', 'throttle:rate_limit,1')
->group(function () {
Route::get('/user', function () {
//
});
});
Copy the code
In the example above, rate_limit is a property of the App\User model that limits the number of requests that the User can make within a specified time.
0
retranslation
View the other version
Broadcast channels
routes/channels.php
make:channel
php artisan make:channel OrderChannel
Copy the code
routes/channels.php
use App\Broadcasting\OrderChannel;
Broadcast::channel('order.{order}', OrderChannel::class);
Copy the code
0
retranslation
Generate the API resource controller
create
edit
php artisan make:controller API/PhotoController --apiCopy the code
Creation of the Eloquent date
You can individually customize the format in which the date or time is created:
protected $casts = [
'birthday' => 'date:Y-m-d',
'joined_at' => 'datetime:Y-m-d H:00',
];
Copy the code
This format is suitable for serializing the model to an array or JSON data.
0
retranslation
Blade Component Alias
If your Blade components are in a subdirectory, you can now give them individual names to use. For example, suppose a Blade components stored in resources/views/components/alert. The Blade. PHP, you can use the method of component from the component of the components. The alert to the alias alert:
Blade::component('components.alert', 'alert');
Copy the code
Once the component has been aliased, it can be rendered using the alias:
@component('alert')
<p>This is an alert component</p>
@endcomponent
Copy the code
0
retranslation
Argon2 password hash
Laravel 5.6 supports a new password hashing algorithm if you’re building an application based on PHP7.2 or more. The default application hash driver is controlled by the new config/hashing. PHP configuration file.
Laravel-news.com/laravel-agr…
UUID method
Illuminate\Support\Str
// Both methods return Ramsey\Uuid\Uuid object: return (string) Str:: Uuid (); return (string) Str::orderedUuid();Copy the code
The orderedUuid method generates a UUID with the highest timestamp, indexed by a database such as MySQL, which is simpler and more efficient.
0
retranslation
Error message
Collision coming to Laravel 5.6
dev
Bootstrap 4
The beta
preset
Bootstrap 4
0
retranslation
To learn more
Upgrade guide
1
retranslation
View the other version
All translations in this article are for study and communication purposes only. Please note the translator, source, and link to this article
Our translation work is in accordance with
CCIf our work has violated your rights and interests, please contact us immediately.