How to install Laravel-admin in your new Laravel project

In this tutorial I am going to walk you through the quick and easy process of installing a Laravel-admin dashboard in your new Laravel project. I am going to make this as brief as possible and also straight to the point .

Laravel as a framework has a lot of out of the box features and packages to make the life of a developer easier. One of such package is the Laravel-admin. With the Laravel-admin a developer can have a fully functional admin dashboard up and running by just initiating very few commands. I will take you through the step by step process of getting this up and running;

*First you need to git bash inside your htdoc folder and run the

composer create-project laravel/laravel ProjectName

command to set up your new laravel project .

*The next thing you should do is to set up a database for your project and link it to your laravel project in your .env file.

*Then you git bash inside your project folder and run

composer require encore/laravel-admin:1.*

command to begin the process of setting up your laravel-admin dashboard.

*After that you run

php artisan vendor:publish --provider="Encore\Admin\AdminServiceProvider"

which will generate the configuration.

*The next step will be to run the laravel-admin installation but you might encounter an error that says "SQLSTATE[42000]: Syntax error or access violation: 1071 Specified key was too long; max key length is 1000 bytes (SQL: alter tableusers add uniqueusers_email_unique (email))". To avoid this you error you need to first go to your project folder using your favourite editor and enter in to app/providers/AppServiceProviders then you add " Schema::defaultStringLength(191); " to your boot function then you use "use Illuminate\Support\Facades\Schema;" at the top of your AppServiceProvider file . Save your changes.

*When this is done you can check your database connection one more time to ensure it is connected . If everything is set then you run

php artisan admin:install

*Finally open your browser and enter localhost/ProjectName/admin this will take you to the admin dashboard for your project . The default username is 'admin' and password is 'admin'.

You might encounter an error that says (Declaration of Encore\Admin\Form\Field\Checkbox::groups($groups = Array) should be compatible with Encore\Admin\Form\Field\Select::groups(array $groups)). This totally depends on your laravel version and laravel-admin version but do not worry.

If you encounter this error follow this link ( github.com/charlesawulor/vendor ) and download this vendor folder . Delete the vendor folder in your project and replace with the downloaded vendor folder. This will solve the problem. Open your browser again and enter localhost/ProjectName/admin then login. Good luck!