Laravel Database Migration Error Key too long

When doing a database migration on Laravel, i get following error

$ php artisan migrate

[Illuminate\Database\QueryException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes (SQL: alter table users add unique users_email_unique(email))

[PDOException]
SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 767 bytes
$

This is because MariaDB use different UTF8 format.

To fix, edit file

Inside, find

Replace with

You will also need to add

here is how my file look like after editing.

Laravel