Laravel 5.7 New Features With Explanation And Laravel Nova.

LARAVEL 5.7 New Features

  • register method removed

    register method has been removed from Illuminate\Foundation\Application class' registerpublic function register($provider, $force = false);
  • The Authenticate Middleware updated

The authenticate method of the Illuminate\Auth\Middleware\Authenticate has been updated for each request.

  • Laravel Nova Introduced

    Laravel 5.7 introduces with Laravel Nova from where you can simply make your administrator dashboard with a lot of features. Laravel Nova Supports all features filters, lenses, actions, queued actions, metrics, authorization, custom tools, custom cards, custom fields and more
  • Email Verification
    A new field email_verified_at added to users table in order to verify the user email .So only verified emails will access the routes
    Verification controller is added on your controller list as
use Illuminate\Contracts\Auth\MustVerifyEmail; 

class User extends Authenticatable implements MustVerifyEmail
{
use Notifiable;
}
In Kernel.php file you will find the verified middleware 
protected $routeMiddleware = [
'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class,
]
For implementation of verify email a call is done from web.php in your route directory
Route:call();
Auth::routes(['verify' => true]);

Guest User Gates / Policies
previous version of Laravel, authorization gates and policies automatically returned false for unauthenticated visitors to your application. now you may allow guests to pass through authorization checks by declaring an “optional” type-hint or supplying a null default value :

Gate::define('update-post', function (?User $user, Post $post) {

});
  • Symfony Dump ServerThe Symfony Dump Server is more than useful in debugging an error for which you don’t have to hinder the application on runtime. Command to use in prompt
php artisan dump-server

// Output to the HTML file.
php artisan dump-server --format=html > dump.html
  • URL Generator & Callable Syntax

Instead of only accepting strings, Laravel’s URL generator now accepts “callable” syntax when generating URLs to controller actions:

action([UserController::class, 'index']);

New Pagination Link Customizations
You may control how many additional links are displayed on each side of the paginator’s URL “window”.

User::paginate(10)->onEachSide(5);
{{ $users->onEachSide(5)->links() }}

Reading or Writing Stream methods in FileSystem
This allows easy reading/writing of files across filesystems and to response-streams.

Storage::disk('t1')
->writeStream(
'remote-file.zip',
Storage::disk('local')->readStream('test.zip')
);
return response()
->stream( function() {
fpassthru( Storage::disk('t1')->readStream('test-1.zip') );
});

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *