Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel nova tool not working with Class not found error

I'm creating a tool with laravel nova.

I ran this command first,

php artisan nova:tool mytools/cachier

And then in my mai app directory App\Providers\NovaServiceProvider I added,

use Mytools\Cachier\Cachier;

public function tools()
    {
        return [
            new Cachier(),
        ];

    }

This is my tool composer json

{
    "name": "mytools/cachier",
    "description": "A Laravel Nova tool.",
    "keywords": [
        "laravel",
        "nova"
    ],
    "license": "MIT",
    "require": {
        "php": ">=7.1.0"
    },
    "autoload": {
        "psr-4": {
            "Mytools\\Cachier\\": "src/"
        }
    },
    "extra": {
        "laravel": {
            "providers": [
                "Mytools\\Cachier\\ToolServiceProvider"
            ]
        }
    },
    "config": {
        "sort-packages": true
    },
    "minimum-stability": "dev",
    "prefer-stable": true
}

But now when I'm trying to access app I'm getting this error.

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Class 'Mytools\Cachier\Cachier' not found

It would be great if someone can help :'(

like image 208
vimuth Avatar asked Oct 29 '25 19:10

vimuth


1 Answers

For anyone googling this--or OP if you haven't figured it out yet--I had this issue because I didn't run the composer or npm commands while generating the tool. Try composer update mytools/cachier from the project root.

like image 50
jahsome Avatar answered Oct 31 '25 10:10

jahsome



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!