Core Types and Enums
This reference lists the key package types used in source registration and metadata output.
Core classes
Ihasan\ReportBuilder\ReportBuilderregisterDataSource(DataSourceContract $dataSource): voiddataSource(string $key): DataSourceContractdataSources(): array
Ihasan\ReportBuilder\DataSources\EloquentDataSource- default implementation for model-backed sources
Ihasan\ReportBuilder\Support\Field- fluent builder for
FieldDefinition
- fluent builder for
Ihasan\ReportBuilder\DTOs\FieldDefinition- normalized field metadata object
Contracts
DataSourceContractkey(): string- machine key used in API pathslabel(): string- human label shown in UIfields(): array- all allowedFieldDefinitionvaluesfield(string $key): ?FieldDefinition- lookup one field by keyquery(): EloquentBuilder|QueryBuilder- trusted base query for this sourceapplyScope(...): EloquentBuilder|QueryBuilder- apply user/tenant/request scopesauthorize(Request $request): bool- controls access to source metadata
Column definitions with Field
Each field key is public API metadata. column() maps that field to your trusted DB column.
php
Field::decimal('total_amount')
->label('Total Amount')
->column('orders.total_amount')
->sortable()
->groupable()
->filterable([FilterOperator::Eq, FilterOperator::Between])
->aggregates([AggregateFunction::Sum]);Rule of thumb:
- key = frontend contract
- column = backend trusted mapping
- operators/aggregates = allowlist for future query execution
Enums
FieldTypestring,integer,decimal,boolean,date,datetime
FilterOperatoreq,neq,gt,gte,lt,lte,between,in,not_in,like,is_null,not_null
AggregateFunctioncount,sum,avg,min,max
Exceptions you will commonly see
DataSourceAlreadyRegisteredExceptionDataSourceNotFoundExceptionInvalidDataSourceConfigurationException