KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Laravel 5.8 / Class 'koolreport\KoolReport' not found #1292

Closed Jim Adamek opened this topic on on Feb 7, 2020 - 4 comments

Jim Adamek commented on Feb 7, 2020

I have a working DataGrid report on a php site and am currently upgrading that site to Laravel. I decided to install KoolReports 4.5.1 on Laravel with composer to begin migrating my KoolReports there.

I added the core and datagrid folders to vendor > koolreport where the laravel folder was installed by composer. I then added one of my reports in the App\Reports folder. The file is named SecurityLog.php and shown here.

<?php

namespace App\Reports;

class SecurityLog extends \koolreport\KoolReport
{
    use \koolreport\laravel\Friendship;

    function setup()
    {
        $this->src("my_database")
        ->query("SELECT * FROM security")
        ->pipe($this->dataStore("security"));
    }
}

I installed the view, controller and blade files as well. I also added the route designation I am using and got this error: "Class 'koolreport\KoolReport' not found"

Here is my Laravel error log:

local.ERROR: Class 'koolreport\KoolReport' not found {"userId":1,"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalErrorException(code: 1): Class 'koolreport\\KoolReport' not found at G:\\wamp\\www\\jasnia\\app\\Reports\\SecurityLog.php:7)

I cleared cache in Laravel, ran composer dump-autoload. I checked composer.json and "koolreport/laravel": "^2.0" is there. I do not see that the composer autoloader has written any declaration for koolreport to the config\app.php file. Is it supposed to?

Thanks for your help in advance!

KoolReport commented on Feb 8, 2020

Could you please post your "requires" section of your composer.json

Jim Adamek commented on Feb 8, 2020

composer.json

    "require": {
        "php": "^7.1.3",
        "barryvdh/laravel-ide-helper": "^2.6",
        "doctrine/dbal": "^2.7",
        "fideloper/proxy": "^4.0",
        "guzzlehttp/guzzle": "^6.3",
        "koolreport/laravel": "^2.0",
        "laracasts/flash": "^3.0",
        "laracasts/presenter": "^0.2.1",
        "laravel/framework": "5.8.*",
        "laravel/socialite": "4.*",
        "laravelcollective/html": "^5.7",
        "league/oauth1-client": "^1.6",
        "mews/captcha": "^2.2",
        "pusher/pusher-php-server": "^3.2"
    },
    "require-dev": {
        "beyondcode/laravel-dump-server": "^1.0",
        "filp/whoops": "^2.1",
        "fzaninotto/faker": "^1.5",
        "mockery/mockery": "^1.0",
	"nunomaduro/collision": "^2.0",
        "phpunit/phpunit": "^7.0",
        "symfony/css-selector": "^4.0",
        "symfony/dom-crawler": "^4.0"
    },

KoolReport commented on Feb 8, 2020

I understand now, please do this in your composer.json and run update command

    "require": {
        ...
        "koolreport/core": "^4.5",
        "koolreport/laravel":"^2.0"
        ...
    },

The koolreport core should be registered with composer for the whole things to work. By the way, I see that you are KoolReport Pro owner, you can go to My Licenses page to generate Composer Token key to install koolreport pro including koolreport and all packages. Or you can install some of the package like above is also fine. Including the token key, you are able to install our commercial packages like Export, Pivot .etc.

Hope that helps.

Jim Adamek commented on Feb 8, 2020

Thank you! That got me going... I should have started with the token information you provided!

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
solved

Laravel