Laravel Tutorial #4: Admin Panel

More Tutorials on Web Development

Every website requires an admin panel. Unfortunately, unlike Django, Laravel does not include a built-in admin panel, but there are still lots of other choices.

In this tutorial, we’ll use Laravel Nova and Voyager as examples. Nova is the official admin panel for Laravel apps, created by the same team that developed the Laravel framework. While if you prefer a free admin panel, Voyager is a good choice.

Laravel Nova

Download Laravel Nova

First, you need to register a new account and purchase a license. The solo license is $99 per project, and it includes all features of Laravel Nova. This part should be pretty straightforward.

Laravel Nova Price

After that, go to the “Releases” page, and download the latest version.

Laravel nova

Install Laravel Nova

Uncompress the file you just downloaded, you should get a folder named something like laravel-nova-fd55xxxxxxxxxxxxxxxxxxc5b5. Rename it into nova, and put it in the root directory of our project like this:


Once you are done, we need to update the composer.json file. Add the following configuration:

"repositories": [
        "type": "path",
        "url": "./nova"

Now, in the require section, add laravel/nova like this:

"require": {
    "php": "^7.2.5",
    "fideloper/proxy": "^4.2",
    "laravel/framework": "^7.0",
    "laravel/nova": "*"

After the composer.json file has been updated, run the update command in the terminal.

composer update
composer update

Finally, run the nova:install and migrate Artisan commands. The nova:install command will install Nova’s service provider and public assets within your application:

php artisan nova:install

php artisan migrate
install nova

After that, we need to check if the Nova service provider has been registered. Open config/app.php and scroll down to the App Service Provider section. If you don’t see NovaServiceProvider, add the following code:


Open the browser and go to http://localhost/nova. You should see the login page.

laravel nova login page

Create A New User

However, we still need a new user account to log in. We can add one using the nova:user artisan command:

php artisan nova:user

You will be prompt to input you name, email, and password. After that, you should be able to log in with the account.

create new user
laravel nova dashboard

Define Resources

Now, we need to integrate Nova with our Laravel application by defining “Resources”.

In Laravel Nova, each “resource” corresponds to a Eloquent model in our blog app. By default, Nova resources are stored in the app/Nova directory of our application. You may generate a new resource using the nova:resource Artisan command:

php artisan nova:resource Post

The resource this command generated corresponds to the Post model of our blog application. For now, we only care about $title, $search, and fields().

$title defines the value that should be used when the resource is being displayed. For example, when you try to search for a post in Nova, you would want the “title” of the post to be displayed, instead of just an id.

As for $search, we would want to search by title, meta title, or content. Add the following code in the resource:

     * The single value that should be used to represent the resource when being displayed.
     * @var string
    public static $title = 'title';

     * The columns that should be searched.
     * @var array
    public static $search = [
        'title', 'content',

And for the last part, fields(), we need to talk about it in detail later.


Install Voyager

First, include the Voyager package using composer:

composer require tcg/voyager
composer require voyager

The following command will install Voyager:

php artisan voyager:install
install voyager

If you want some dummy data for our project, use this command instead:

php artisan voyager:install --with-dummy

Installation complete.

voyager installation complete

Next, we need to create a new admin user:

php artisan voyager:admin --create

Follow the instructions and type in your user name and password.

input credentials

Start the server and make sure it is running on port 8000. Run the following command to start the Laravel development server:

php artisan serve

Or if you prefer using XAMPP, open the apache configuration file and make these changes:

configure apache
configure apache

This will make Apache serve on port 8000. Finally, visit the URL http://localhost:8000/admin in your browser, and log in with your credentials.

Although Voyager is not as powerful as Nova, it is much easier to setup and use. Once you installed it, you don’t need to write a single line of code.

Image Not Loading

This is a common problem with Voyager if you are using XAMPP, and it is really easy to solve. Edit the .env file. Change APP_URL to http://localhost:8000.

voyager fix image not loading

30 thoughts on “Laravel Tutorial #4: Admin Panel”

  1. My Laravel version:
    “require”: {
    “php”: “^7.3”,
    “fideloper/proxy”: “^4.2”,
    “fruitcake/laravel-cors”: “^2.0”,
    “guzzlehttp/guzzle”: “^7.0.1”,
    “laravel/framework”: “^8.0”,
    “laravel/tinker”: “^2.0”,
    “tcg/voyager”: “^1.4”

    Error installing Voyager:
    Downloading (100%)
    doctrine/cache suggests installing alcaeus/mongo-php-adapter (Required to use le
    gacy MongoDB driver)
    intervention/image suggests installing ext-imagick (to use Imagick based image p
    intervention/image suggests installing intervention/imagecache (Caching extensio
    n for the Intervention Image library)
    tcg/voyager suggests installing laravel/legacy-factories (Required to run Voyage
    r tests with Laravel 8.x)
    Writing lock file
    Generating optimized autoload files
    > Illuminate\Foundation\ComposerScripts::postAutoloadDump
    > @php artisan package:discover –ansi


    SQLSTATE[HY000] [2002] Iiaee??aiea ia onoaiiaeaii, o.e. eiia?iue eiiiu?oa? ioa
    a?a cai?in ia iiaee??aiea.

    at C:\wamp64\www\chords\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDO\Exce
    14aЦХ final class Exception extends PDOException
    15aЦХ {
    16aЦХ public static function new(\PDOException $exception): self
    17aЦХ {
    az? 18aЦХ return new self($exception);
    19aЦХ }
    20aЦХ }

    1 C:\wamp64\www\chords\vendor\doctrine\dbal\lib\Doctrine\DBAL\Driver\PDOConn

    2 [internal]:0
    Script @php artisan package:discover –ansi handling the post-autoload-dump even
    t returned with error code 1

    Installation failed, reverting ./composer.json to its original content.

    1. Please check your App\Providers\AppServiceProvider, make sure there are no mistakes. If that doesn’t work, go to config/app.php, it could be because you added the service provider for the package that is not installed in the system.

  2. This has been super helpful. Most of the documentation available is for older versions of Laravel. I’m a beginner so that has been frustrating. Thanks so much for making these tutorial using the latest version.

  3. Just when I was doing good at understanding how Laravel works, lessons 1-3, in lesson 4 you require me to spend $99 to continue using your tutorial.
    That is a show stopper. And that really is a bummer because this is the best tutorial I have found. Now I have to find another good tutorial.

    1. Hello, sorry for the confusion but section 4 has two parts, Laravel Nova and Voyager. If you do not want to pay for Nova, you can always go for Voyager, which is a free open-source admin panel.

  4. Hi Eric,

    Thank you for this tutorial.
    I have a problem I am not able to solve. I cannot install Voyager. I run the command “composer require tcg/voyager” in my project directory, but I keep getting the below error message:

    Installing dependencies from lock file (including require-dev)
    Package operations: 1 install, 0 updates, 0 removals
    – Installing tcg/voyager (1.x-dev e9160b7): Cloning e9160b7c10
    Cloning failed using an ssh key for authentication, enter your GitHub credentials to access private repos
    Head to
    to retrieve a token. It will be stored in “C:/Users/Diana/AppData/Roaming/Composer/auth.json” for future use by Composer.
    Token (hidden): Install of tcg/voyager failed

    Installation failed, reverting ./composer.json and ./composer.lock to their original content.

    copy(phar://C:/ProgramData/ComposerSetup/bin/composer.phar/vendor/symfony/console/Helper/../Resources/bin/hiddeninput.exe): failed to open
    stream: phar error: “vendor/symfony/console/Resources/bin/hiddeninput.exe” is not a file in phar “C:/ProgramData/ComposerSetup/bin/composer

    Can you please help me? Ive looked for a solution everywhere online to no joy

    1. It seems that the “hiddeninput.exe” is missing. Maybe you can try reinstalling composer. If that doesn’t work, it is possible that your antivirus software is blocking it.

    2. Hello,

      I’m unable to install voyager. First it required a token from github which I managed to
      provide and then the process aborts. it says “C:\\xamp\htdocs\blog/vendor/composer/tmp-c0af70fedf72a4b143180………….’ is not a zip archive”

      Please help

    3. Hi Eric, I have some problem following your step.
      when I tried to php artisan voyager:install
      I always get this exception
      SQLSTATE[HY000] [1049] Unknown database ‘laravel_db’
      I need to create my db at phpmyadmin first and connect it with .env file right?
      I’m newbie to this. so thankyou for your helpful articles 😀

    4. Hello Eric, i stumbled across this great tutorial of yours and it has been helpful to me. But i have problem installing the voyager.
      Prompting for a token(hidden) which i managed to get from github but i couldnt enter it. I tried to copy and paste it but it didn’t work and i also tried to type it but nothing showed on the screen. The cursor was busy blinking on the same spot. Please help me out. i wanna taste the sweetness of laravel!

    5. DO I create a user with Voyager with:
      php artisan voyager:user ?

      Great tutorial by the way, probably the best I’ve found so far.

      1. create db still not able to connect… Till chapter 3 topics were interesting but as soon as I started installing Voygar things got messed up where I am constantly getting error msg “SQLSTATE[HY000] [1049] Unknown database ‘admin_laravel'” whereby admin panel is admin_laravel. I don’t know how to proceed and planning to abort this class….

        1. You have to create the database first from PhpMyAdmin, the Voyager installation script only installs the software for you, only you have the permission to create the database.

      2. Hello ERIC HU. After I do all these things, but when I run it in local host, 404 error was raised. Can you help me.
        Thank you!

Leave a Reply

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