How do I create a custom report?

To create and register a custom report you need to use the Aero\Admin\AdminReport facade inside of your app service providers boot method or module service providers setup method.

The facade requires a class that extends Aero\Admin\Reports\Report. Additionally, you can provide a title and summary (shown in the reports list in the admin) and any permissions required to use the report.


namespace Acme\MyModule;

use Acme\MyModule\Reports\OrdersReport;
use Aero\Admin\AdminReport;
use Aero\Common\Providers\ModuleServiceProvider;

class ServiceProvider extends ModuleServiceProvider
   public function setup()
           ->title('Simple Orders Report')
           ->summary('View a simple report for your orders')

Your report class must implement a newQuery method that must return a Illuminate\Database\Eloquent\Builder. This method provides the query your report will run from.


namespace Acme\MyModule\Reports;

use Aero\Admin\Reports\Report;
use Aero\Cart\Models\Order;
use Illuminate\Database\Eloquent\Builder;

class OrdersReport extends Report
   protected function newQuery(): Builder
       return Order::with([
           'status', 'items', 'currency', 'discounts', 'payments.method',

Articles in this section

Was this article helpful?
0 out of 0 found this helpful