md0 / backpack-regenerator
Laravel ReGenerator for Backpack
Requires
- backpack/crud: ^4.1.0|^5.0.0
- dompdf/dompdf: ^1.0.0
- md0/regenerator: dev-main
This package is auto-updated.
Last update: 2023-11-08 03:36:43 UTC
README
A CRUD interface for the ReGenerator report generator built using Laravel Backpack.
This is meant to complement ReGenerator's features and not replace them. Use this interface sparingly, as it gives direct write access to your database. Never allow your end users to create or update reports!
Should work on any version of Laravel above 5.6, but was only tested on v8.
Screenshots
Installation
Require the package via Composer:
composer require md0/backpack-reportgenerator
Run the database migrations if you haven't already done so when installing ReGenerator:
php artisan migrate
Publish ReGenerator's assets to enable the chart output. This will place Chart.js in your public folder:
php artisan vendor:publish --provider="MD0\ReGenerator\ReGeneratorServiceProvider" --tag="assets"
Optional
Add a menu entry for the new Reports page inside resources/views/vendor/backpack/base/inc/sidebar_content.blade.php:
<li class="nav-item"><a class="nav-link" href="{{ backpack_url('reports') }}"><i class="nav-icon la la-file-invoice"></i>{{ __('Reports') }}</a></li>
Publish the language files, if you need to translate the intarface. You'll find the JSON files inside the resources/lang/vendor/backpack-regenerator folder. Feel free to contribute additional tanslations if you find this package useful.
provider="MD0\BackpackReGenerator\BackpackReGeneratorServiceProvider" --tag="lang"
Usage
Point your browser to [backpack_url]/reports and manage your reports using Backpack CRUD controls.
Setting permissions
To limit user access to certain CRUD operations and / or certain report groups you may set the persmissions dynamically by overwriting the config values in a middleware (this example assumes you're using the Laravel Permission package):
if (auth()->user()->hasRole('accounting')) { config()->set('md0.backpack-regenerator.allow_update', false); config()->set('md0.backpack-regenerator.restrict_by_tag', 'accounting'); }
Overwriting
Changinng the default URL route
To change the default /reports URL, you'll have to:
- Publish the routes file and change the route path:
php artisan vendor:publish --provider="MD0\BackpackReGenerator\BackpackReGeneratorServiceProvider" --tag="routes"
Replace all occurences of reports inside routes/backpack-regenerator.php with your chosen alternative.
- Publish the config file and update Backpack's route:
php artisan vendor:publish --provider="MD0\BackpackReGenerator\BackpackReGeneratorServiceProvider" --tag="config"
Replace the value for route_name inside config/md0/backpack-regenerator.php.
Changing the report preview button and / or HTML modal
Publish the views and edit the files inside resources/views/vendor/md0/backpack-regenerator. The view files ar stored in folders following the Backpack structure (buttons, columns).
php artisan vendor:publish --provider="MD0\BackpackReGenerator\BackpackReGeneratorServiceProvider" --tag="views"
Errors & Suggestions
Please submit your improvement suggestions or report bugs / errors in the Issues
section.
License
Distributed under the GPL-3.0 License. See LICENSE
for more information.