Laravel 5.2 is now officially released!

There are many new features. Let's check them out:

Middleware Groups

Middleware groups is a really good feature that you may want. You can now apply group of middlware to routes

enter image description here

MySQL JSON Column Types

Laravel 5.2 now adds support native JSON data type

Form Array Validation

Now you can add validation rules to loop through arrays automatically and validate those arrays for you.

Form input:

<p>
<input type="text" name="post[1][id]">
<input type="text" name="post[1][title]">
</p>

<p>
<input type="text" name="post[2][id]">
<input type="text" name="post[2][title]">
</p>

Validation rules:

Validator::make($request->all(), [
  'post.*.id' => 'exists:posts.id',
  'post.*.title' => 'required:string',
]);

Database Session Driver

The database session driver now includes user_id and ip_address.

Collections Wildcards

You can use * as a wildcard to get data from a collection

$posts->pluck(‘users.*.name’);

Auth Scaffolding

Want a set of view files for authentication, registration, and password resets? You can easily generate those using:

php artisan make:auth

Implicit model binding

Now you can tell Laravel to automatically binds a model to a route:

Route::get('/posts/{post}', function(Post $post) {
    return $post;
});

Laravel will run Post::findOrFail($post) and inject the result into the $post variable automatically! Cool!

Authentication Drivers / "Multi-Auth"

In Laravel 5.2, you may define additional authentication drivers as well define multiple authenticatable models or user tables. For example, if your app has multiple tables, you may now use the Auth methods to authenticate against each of these tables separately.

Eloquent Global Scope Improvements

In Laravel 5.2, global query scopes only require you to implement a single, simple method: apply.

Rate Limiting

You can now easily limit the number of requests that a given IP address can make to a route. To limit a route to 30 requests every minute from an IP address, you can do like this:

Route::get('/dashboard', ['middleware' => 'throttle:30,1', function () {
    //
}]);

Conclusion

You can check the official release notes here:

http://laravel.com/docs/5.2/releases#laravel-5.2

Also, let's check the upgrade guide to upgrade your app:

http://laravel.com/docs/master/upgrade#upgrade-5.2.0

Be sure to join our newsletter to get latest news and freebies.