What’s New Features in Laravel 5.8

Hello guys today I’m going to tell you about the feature of Laravel 5.8. I would like to tell you that Laravel 5.8 has been released.
Laravel 5.8 is released on February 26th, 2019.What features have been updated in Laravel 5.8? Let me tell you step to step so let’s go.

1.Cache TTL Change
2.Automatic Policy Resolution
3.Laravel 5.8 Deprecates String and Array Helpers
4.Laravel 5.8 Blade Template File Path
5.Carbon Updates

1.Cache TTL Change

Here’s an example using Carbon’s addMinutes():

Cache::remember('active-posts', now()->addMinutes(5), function () {
return Post::active()->get();
});

2.Automatic Policy Resolution

laravel 5.8 Policy Resolution

Gate::guessPolicyNamesUsing(function ($class) {
// Do stuff
return $policyClass;
});

In laravel 5.7

protected $policies = [
'App\Model' => 'App\Policies\ModelPolicy'
];

3.Laravel 5.8 Deprecates String and Array Helpers

The helpers will still be available in 5.8. However, you should use the \Illuminate\Support\Str and Illuminate\Support\Arr classes directly instead of using the helpers:-

// Deprecated
array_add($array, $key, $value);
// Use this directly
Arr::add($array, $key, $value);

4.Laravel 5.8 Blade Template File Path

This feature has been added to 5.8.In laravel 5.8 they provide path of blade template file path as shown in example:-

<?php /* /var/www/me/5.8/blog/resources/views/welcome.blade.php */ ?>
<html>
<head>
<title>Laravel 5.8 New Feature</title>
</head>
<body>
<h1>Laravel 5.8 New Feature</h1>
</body>
</html>

5.Carbon Updates

public function register()
{
Date::use(carbanImmutable::class);
}