Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Models or Laravel Query builder #6

Open
ghost opened this issue Dec 11, 2016 · 11 comments
Open

Models or Laravel Query builder #6

ghost opened this issue Dec 11, 2016 · 11 comments

Comments

@ghost
Copy link

ghost commented Dec 11, 2016

Is it possible to use models including their relationships or laravel query builder to generate the reports.
I have a complex database structure that i used to handle with such as Eloquent. I feel that it would be cumbersome to use SQL queries especially that i don't want to use JOINS and UNIONS on over 10 tables.
Please advise

@reportico-web
Copy link
Owner

Hi there

I think the quickest way of getting this going would be to use the Custom Source Code feature to allow you to plug in the Laravel code necessary to use the builder to perhaps create a temporary table of the results and then use a simple select to return the data..

I'll send you an example later but it will follow the documentation here :-
http://www.reportico.org/documentation/4.5/doku.php?id=custom_source_code&s[]=custom

I just might need to give you etra info for hooking into laravel.

Peter

Peter

@ghost
Copy link
Author

ghost commented Dec 14, 2016

Hi, Thanks. Waiting for the examples. Also let me know how to remove the password for reportico. just want to use laravel auth.

@lrojas94
Copy link

lrojas94 commented Dec 14, 2016

Interested in using the Laravel Auth too. Any help would be appreciated :)

@reportico-web
Copy link
Owner

Hi there

If you are using the latest version 5.3 then you can set the reportico admin password to OPENACCESS .. the double underscores are needed.

You will need to edit the file vendor/reportico/laravel-reportico/src/Reportico/Reportico/projects/admin/config.php and set the SW_ADMIN_PASSWORD to the above to achieve this.... hope that works for you ..

.. been a bit busy but will aim to send you custom code info tomorrow

Peter

@lrojas94
Copy link

Tried using the OPENACCESS password (with underscores at start/end), but that only set it up as a password xD...

@lrojas94
Copy link

So, clearing the password entirely allows me to bypass the admin password prompt. However, I tried adding Laravel Auth by:

->middleware('auth')

However, it seems reportico kills Laravel session or something of the sort. I don't have access to Laravel auth information (which is located in the session) when I enter /reportico. However, anywhere else, I do.

Any ideas?

@reportico-web
Copy link
Owner

reportico-web commented Dec 15, 2016

Hi there

Im investigating this ..ive recreated it

A couple of questions ...

  • can i ask did you add this in the ReporticoServiceProvider.php in the route
  • what version of Laravel are you using?
  • if you are using 5.x of laravel do you know what version of the package you have got?

Also regarding OPENACCESS password if you look in line 140 of swpanel.php down in vendor/reportico/laravel-reportico/src/Reportico/Reportico/swpanel.php you should see what iti looks like .. if you dont see it you probably arent on the latest version which supports it

@lrojas94
Copy link

lrojas94 commented Dec 15, 2016

The middleware part I added on the Routes.php file, which I configured myself to properly use a controller.
However, I also tested doing an var_dump(Auth::user()) which always seem to return null for some reason, even though under any of the normal laravel routes (/login for example) it works just fine.

Laravel version: 5.3
Reportico Version: "reportico/laravel-reportico": "^5.3"

Finally, regarding open access, you're right. It works :). I only had a single undersore on each side. However, setting the password to empty is also a good option, as it redirects the user directly onto design mode.

@reportico-web
Copy link
Owner

Hi there,

@lrojas94 , I think I fixed the auth problem.

Basically Reportico uses the "web" middleware for token/session handling, this middleware starts the session. I think if you add the auth middleware there it probably tries to get the auth user before starting the session which doesnt exist.

I think i got a fix which ive uploaded so you should be able to do a composer update. However you need to change something to get it working.

In vendor/reportico/laravel-reportico/src/Reportico/Reportico/ReporticoServiceProvider.php on line 34 you will see 2 route defintions, one commented out ..

//\Route::group(['middleware' => ['web','auth']], function() { \Route::group(['middleware' => ['web']], function() {
I think you can take your route out and use this instead. Just comment out the 'web' only one, and uncomment the'web','auth' one to enable auth. The problem i had in debugging this is i had auth before web which causes the session to go wrong. I hope im right in this and it works for you because im not a laravel expert by a mile !!

PS.. what i want to do is auto detect whether auth is enabled and use auth if it is, but im having trouble detecting whether auth is enabled. I dont know if you have any ideas.

@samueldervis , sorry about lack of examples .. i got distracted with this problem .. hope to give you some soon

@ghost
Copy link
Author

ghost commented Jan 11, 2017

You should add setting password option (true/false), in config folder.
I dont think it is nice to edit the files you mentioned in vendor directory.
e.g vendor/reportico/laravel-reportico/src/Reportico/Reportico/swpanel.php or even this config file at vendor/reportico/laravel-reportico/src/Reportico/Reportico/projects/admin/config.php.

It would be nice to move all configuration and settings from the vendor directory.
For example in most cases i do not upload the vendor directory to the server. Because i would do the composer update .

@reportico-web
Copy link
Owner

Thanks for the suggestion, I totally agree with you. ...i will research how to go about this.. if you have any pointers on where exactly the config should be stored? Would it get put in public/vendor/reportico with the other assets with an artisan vendor:publish call or stored under laravel config folder somehow.. ? I am still learning laravel and am sure i am missing a few tricks like this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants