Good afternoon. I have the following tables: one for students, one for the regions where students live, they are related through the IdRegioes field.
I would like to bring the data on student counts by region, according to some criteria to be displayed in my summary view, using SQL in the database I would have the following query:
SELECT i.regioes_idregioes, r.regiao, COUNT(i.regioes_idregioes) AS quantidade FROM inscricoes as i, regioes as r WHERE i.Regioes_IdRegioes = r.IdRegiao and i.Atendido ='N' and i.Evadido = 'N' and i.Desistente = 'N' and i.DataNascimento >= '2015-03-31' GROUP BY i.regioes_idregioes;
When transporting this query to an Eloquent template I did the following:
$TotInscRegioes = Inscricao::selectRaw('inscricoes.Regioes_IdRegioes',['count(*) as TotRegiao'],'Regioes.Regiao') ->join('Regioes','inscricoes.Regioes_IdRegioes','=','Regioes.IdRegiao') ->where('Atendido','N')->where('Desistente','N')->where('Evadido','N') ->where('DataNascimento','>=',$dataLimite) ->groupBy('inscricoes.Regioes_IdRegioes','Regioes.Regiao') ->get();
However, I always get the general total of students and not the counting by region. I already researched several and I can not find a way out, have you ever had a situation like this? What was the solution you found?
Note: I have already tried using select and putting -> count () at the end and even then the data did not come apart.
Thank you for help.
Friends, I need help. I created the authentication process in laravel 5.6 with php artisan make: auth, so far so good, it works wonderfully, I log in, log in, and create a new user with the register link. But, now I need to allow the admin user to register users in the system being logged in. I changed the __construct of the RegisterController to allow to view the user registration form for already authenticated users, changing the code to: $ this-> middleware ('auth') ;. It worked perfectly again, but after including a new registry the application automatically logs in this new registry and I did not want this behavior, I would like to change the behavior so that after inclusion the application kept the admin user logged in and was directed to another view. I'm all day looking for a solution and all the links I found no solution solved. What can I do to achieve this or can not be done?
Thanks for the help and excuse me for the long text.
How to do the ordering in laravel by more than one field with the orderby () method? I have a query that should show the results ordered by the field TotalPoints and Birth, however, I can only do with one of the fields. See below:
$inscritos = Inscricao::join('Regioes','inscricoes.Regioes_IdRegioes','=','Regioes.IdRegiao') ->join('Turmas','inscricoes.Turmas_IdTurmas', '=' ,'turmas.IdTurmas')->where('Regioes_IdRegioes',$reg)->where('Atendido','N')->orderby('TotalPontos','Desc')->get();
What can I do to resolve this issue?
It worked!!! I was able to run the report using jasperreports, however, I did not use the lavela I ended up using the geek at https://github.com/PHPJasper/phpjasper, it worked correctly.
Thanks for your tip and for helping me out. Stay with God and have a great weekend.
The report is for an application, are listings and parameterized reports. The dump solution is not an application that stays with users, so they should be free to print the reports at any time without further interference.
I'll check the link you sent, thank you very much for the help.
I need to create reports in pdf using Laravel 5.6 and the Mysql database, how could I do this? I tried using JasperPHP but it does not work right, I used the lavela / phpjasper package, however, it gives some errors that refer to the lack of files during the installation process.
What could you recommend me to do this work correctly?