KoolReport's Forum

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

Laravel : Can I have 2 reports in one controller #2031

Closed george quinones opened this topic on on Apr 15, 2021 - 8 comments

george quinones commented on Apr 15, 2021

Class 'App\Reports\Statements\StatementShow' not found

[root@chilly ~]# cd /home/agentrack/public_html/app/app/Reports/ [root@chilly Reports]# ll total 16 drwxr-xr-x 2 root root 4096 Apr 12 19:23 Clients drwxr-xr-x 2 agentrack agentrack 4096 Apr 12 18:53 Customers drwxr-xr-x 2 root root 4096 Apr 13 18:43 Policies drwxr-xr-x 2 root root 4096 Apr 13 11:19 Statements [root@chilly Reports]# cd Statements/ [root@chilly Statements]# ll total 16 -rwxr-xr-x 1 root root 667 Apr 13 11:13 StatementList.php -rwxr-xr-x 1 root root 452 Apr 13 11:26 StatementList.view.php -rwxr-xr-x 1 root root 665 Apr 15 18:37 StatementShow.php -rwxr-xr-x 1 root root 449 Apr 13 11:25 StatementShow.view.php [root@chilly Statements]# pwd /home/agentrack/public_html/app/app/Reports/Statements

<?php

namespace App\Http\Controllers;

use App\UserStatements; use App\Statements;

use Illuminate\Http\Request; use App\Reports\Statements\StatementList; use \App\Reports\Statements\StatementShow;

class StatementController extends Controller {

/**
 * Display a listing of the resource.
 *
 * @return \Illuminate\Http\Response
 */
public function index()
{
    $report = new StatementList;
    $report->run();
    return view("statements.index",["report"=>$report]);
}

/**
 * Show the form for creating a new resource.
 *
 * @return \Illuminate\Http\Response
 */
public function create()
{
    //
}

/**
 * Store a newly created resource in storage.
 *
 * @param  \Illuminate\Http\Request  $request
 * @return \Illuminate\Http\Response
 */
public function store(Request $request)
{
    //
}

public function show($id)
{
    
    $report = new StatementShow;
    $report->run();
    return view("report",["report"=>$report]);
    //return view("Statements.show",["client"=> UserStatements::findOrFail($id)]);

}
KoolReport commented on Apr 16, 2021

It is totally possible

george quinones commented on Apr 16, 2021

that didnt help . So am I getting the error

george quinones commented on Apr 16, 2021

I will like to see a working example of a controller using multiple reports

as an example index = list of object show = shows one item create = creates an item

I keep getting errors

KoolReport commented on Apr 16, 2021

What error do you get?

george quinones commented on Apr 16, 2021

Class 'App\Reports\Statements\StatementShow' not found

I gave you all my code up front

KoolReport commented on Apr 16, 2021

Please check the StatementShow.php if you have define namespace there. It seems to me is the issue of autoload.

george quinones commented on Apr 16, 2021

that was it

thanks

KoolReport commented on Apr 17, 2021

Great, you are welcome :)

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

None