Updated on 23 Mar 2019 | 4 Min Read

Laravel is an open-source PHP framework that follows the MVC pattern. It is a very popular PHP framework that reduces the cost of development and improves code quality. Our extensive collection of Laravel Interview Questions will help you find a great job. Laravel 5.8 is the latest & current version. It releases on 26th February 2019; Bug Fixes Until August 26th, 2019 and Security Fixes Until February 26th, 2020.

Enhancement Features of Laravel 5.8

There are various features of laravel 5.8 are listed below:-

  • Eloquent hasOneThrough relationships.
  • It has improved email validation.
  • Token Guard Token Hashing.
  • Convention based automatic registration of authorization policies.
  • DynamoDB cache and session drivers.
  • Mock or Spy Testing Helper Methods.
  • It has improved timezone configuration.
  • It supports for assigning various authentication guards to broadcast channels.
  • PSR-16 cache driver compliance.
  • Artisan Call Improvements.
  • Artisan Serve Improvements.
  • Carbon 2.0 support.
  • Pheanstalk 4.0 support.

1. Eloquent hasOneThrough relationships:-

Laravel 5.8 supports new Eloquent hasOneThrough relationship type. We can use a hasOneThrough relationship to access a supplier's account history details through the account model

public function accountDetail()
return $this->hasOneThrough(AccountDetail::class, Account::class);

2. It has improved email validation:-

Laravel 5.8 introduces improvements in email validation logic by acquiring the package egulias/email-validator utilized by SwiftMailer.

3. Token Guard Token Hashing:-

Token guard provides basic API authentication, and now it supports storing API tokens as SHA-256 hashes. Token Guard Token Hashing provides improved security over storing plain-text tokens.

4. DynamoDB cache/session drivers:-

It is an essential feature. It is a serverless NoSQL database invented by Amazon Web Services. The default setting for the dynamodb cache driver can be configured in the configuration file.

5. Mock or Spy Testing Helper Methods:-

It is more convenient, new mock and spy methods have been added to the core Laravel test case class. It automatically binds the mocked class into its container.

For example:

$this->mock(Service::class, function ($mock) {

6. Improved scheduler timezone configuration:-

Laravel 5.8 allows us to customize the timezone of a scheduled task using the timezone method:


7. PSR-16 cache driver compliance:-

It allows a more granular expiration time when storing values and provides agreement with PSR-16 caching standard; the cache item value time-to-live has changed from minutes to seconds.

The put, add, but many, remember and setDefaultCacheTime methods of the Illuminate\Cache\Repository class and its extended classes, as well as the put function of each cache store were modified with this changed behavior.

If we are passing an integer to any of these functions, we should update our code to validate you are passing the number of seconds you wish the value to remain in the cache. Alternatively, we may pass a DateTime instance highlighting when the item should expire:

// In Laravel 5.7

Cache::put('foo', 'bar', 20);

// Laravel 5.8

Cache::put('foo', 'bar', 20);

// Laravel 5.8

Cache::put('foo', 'bar', now()->addSeconds(20));

8. Artisan Call Improvements:-

Laravel 5.8 allows us to pass the entire command, including options with the first string argument to the method:

Note : This information is asked in Laravel interview questions.

Artisan::call('migrate:install --database=foo');

9. Artisan Serve Improvements:-

In laravel 5.7 releases, Artisan's serve command would serve our application on port 8000. If another serve command process is already listening on this port, an attempt to serve a second application via serve will fail. But in Laravel 5.8, serve will now scan for available ports up to port 8009, allowing us to serve multiple applications at a single time.

10. Carbon 2.0 support:-

Laravel provides support for the ~2.0 release of the Carbon date manipulation library.

11. Pheanstalk 4.0 support:-

Laravel provides support for the ~4.0 release of the Pheanstalk queue library. If we are using Pheanstalk library in our application, then please upgrade our library to the ~4.0 release via Composer.

We have a list of laravel interview Questions and Answers and Laravel 5 Interview Questions and Answers then you can click these links. These are really helpful to crack your future interviews.