Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

amitshrestha221's avatar

Custom tool not showing view, blank URL, blank view.

I have created a custom nova tool as per the documentation and added it to tools() in NovaServiceProvider.

However when I click from sidebar, nothing happens, URL is also blank and view is also blank.

I am getting this in log :


[2022-08-15 17:03:28] local.ERROR: file_get_contents(/var/www/saas/nova-components/TrialBalanceReport/src/../dist/js/tool.js): Failed to open stream: No such file or directory {"userId":1,"exception":"[object] (ErrorException(code: 0): file_get_contents(/var/www/saas/nova-components/TrialBalanceReport/src/../dist/js/tool.js): Failed to open stream: No such file or directory at /var/www/saas/vendor/laravel/nova/src/Http/Controllers/ScriptController.php:28)


As per my created tool, following are the code :


class TrialBalanceReport extends Tool
{
    /**
     * Perform any tasks that need to happen when the tool is booted.
     *
     * @return void
     */
    public function boot()
    {
        Nova::script('trial-balance-report', __DIR__.'/../dist/js/tool.js');
        Nova::style('trial-balance-report', __DIR__.'/../dist/css/tool.css');
    }

    /**
     * Build the view that renders the navigation links for the tool.
     *
     * @return \Illuminate\View\View
     */
    public function renderNavigation()
    {
        return view('trial-balance-report::navigation');
    }
}



class ToolServiceProvider extends ServiceProvider
{
    /**
     * Bootstrap any application services.
     *
     * @return void
     */
    public function boot()
    {
        $this->loadViewsFrom(__DIR__.'/../resources/views', 'trial-balance-report');

        $this->app->booted(function () {
            $this->routes();
        });

        Nova::serving(function (ServingNova $event) {
            //
        });
    }

    /**
     * Register the tool's routes.
     *
     * @return void
     */
    protected function routes()
    {
        if ($this->app->routesAreCached()) {
            return;
        }

        Route::middleware(['nova', Authorize::class])
                ->prefix('nova-vendor/trial-balance-report')
                ->group(__DIR__.'/../routes/api.php');
    }

    /**
     * Register any application services.
     *
     * @return void
     */
    public function register()
    {
        //
    }
}

0 likes
0 replies

Please or to participate in this conversation.