Laravel v5.3.19 is now released


October 18th, 2016

Laravel v5.3.19 is now released

Laravel released v5.3.19 which includes a few small changes and improvements as well as a complete rewrite of the middleware sorting so that middleware calls with parameters now work properly.

PHP Artisan make:model

A new addition to Laravel is the ability to specify the creation of a resourceful controller when you are creating a new Model through Artisan. This means you can pass a -c or --controller flag to make:model:

1php artisan make:model Post --controller

Laravel Image Dimensions Validation

New in Laravel v5.3 is the ability to validate image files to ensure they meet certain dimensions and through the validator this can be setup with a string format:

1'avatar' => 'dimensions:min_width=100,min_height=200,ratio=3/2'

Now in v5.3.19 this can be specified through a fluent syntax similar to unique and exists validation rules:


Laravel Validation in and not_in

The in and not_in validation received the ability to pass an array.

1// Previous
3// New

Then the same for not_in

1// Previous
3// New
4Rule::notIn(['php', 'laravel'])

Either style is valid and the new object-based style parses down into the old way. So you are free to use whichever suits your app.

After Validation Hook

Now your controllers can have a new withValidator method so you can easily call any hooks after validation:

1protected function withValidator($validator)
3 $validator->after(function($validator) {
4 if ($this->somethingElseIsInvalid()) {
5 $validator->errors()->add('field', 'Something is wrong with this field!');
6 }
7 });

Previously you had to manually setup the $validator = Validator::make() before you could use an after hook which meant you lost the ability to utilize the ValidatesRequests trait.

Upgrading Laravel

To get this latest version all you need to do is run composer update and you can find a complete list of changes in the changelog

Filed in:

Eric L. Barnes

Eric is the creator of Laravel News and has been covering Laravel since 2012.