Questions tagged as 'querybuilder'

2
answers

How to do an Insert getting FORM data in Laravel 5.2?

I'm looking at the Laravel documentation on dbquery, in the insert case. I need to make the insert out of the resource method (manually. Type: DB::table('users')->insert( ['email' => '[email protected]', 'votes' => 0] ); But...
asked by 12.01.2017 / 16:01
2
answers

Laravel 5 QueryBuilder, results in simplified collection

I'm using the get() method of Laravel's QueryBuilder and would like to know if it's possible to return the id's in a simple one-dimensional array, for example: [35,45] Instead of: [{"id":35},{"id":45}]     
asked by 15.07.2016 / 15:17
1
answer

Laravel 5, assuming variable in empty query?

I have a query, but sometimes this query returns an empty value ( no records ). These query results are directed to the generation of a HighCharts chart, but when there are no values within the query, the graph is not generated. My idea...
asked by 17.11.2018 / 13:41
2
answers

Error when using whereRaw in Laravel

What am I doing wrong in this queryRaw ? The goal is to display the sum values if ID = ID, but I'm getting the total sum of the column. Excerpt from the Controller query: //Show public function show( Pesquisa $pesquisa ) { $this-...
asked by 27.08.2018 / 23:00
1
answer

Return array inside json [closed]

I have the following function in Laravel/QueryBuilder public function getEstudante(Request $request) { $estudante = DB::table('estudantes_identificacao') ->leftJoin('estudantes_telefones','estudantes_telefones.estudantes_...
asked by 22.07.2018 / 15:45
2
answers

Help Query Sum

I'm trying to retrieve a column and make a sum - using SUM - according to the time range, but without success. Can you help me with this question? Detail: I'm not exactly using a table, but I call a function in SQL . The application w...
asked by 26.07.2018 / 00:57
1
answer

Pass variable query buider Laravel

I'm trying to do this function with Laravel Query Builder public function getEstudantesCargaHoraria(Request $request) { $ano_letivo = $request->ano_letivo; $turma_id = $request->id; $ano_letivo = 2017; $turma_id = 528...
asked by 25.06.2018 / 18:27
1
answer

Create query in query builder - laravel

I'm starting to work with Laravel and I need to make a query in the database, it's a simple query, but as I'm starting I still do not know how to do it. I need to get the sales made today, yesterday, this month, previous month, current year...
asked by 14.09.2018 / 22:45
0
answers

Join with three tables Laravel QueryBuilder

I'm trying to do a join with three tables I have a table with county code, a table with the name of the county and a table with the names of the states I need to get the name of the municipality of one table and the name of the state in an...
asked by 18.08.2018 / 20:14
0
answers

query with many-to-many polymorphic laravel?

I have a polymorphic m-m relationship in my bank where:    class (id, name)       student (id, name)       lesson (id, name)       classable (class_id, classable_id, classable_type) A class has several students and several lessons. a s...
asked by 20.02.2018 / 20:52