Questions tagged as 'eloquent'

0
answers

Filter data through AJAX with POST request Laravel 5.4

Goodnight friends. I have a problem with the laravel framework and I can not manage to perform a simple task. When I write in an input I automatically send via AJAX by POST the value of the input to filter my table of users. $("#cedula")...
asked by 10.06.2018 / 06:13
0
answers

RELATIONSHIP MANY MANY LARAVEL

I am trying to make a relationship and a query but apparently something is wrong because it is not what I am looking for. I'm still starting with laravel and I still have doubts. My summary tables are the following: And the data that...
asked by 04.06.2018 / 17:31
1
answer

Eloquent query in three tables

Good afternoon I need to make a query in laravel but the results are not what I hope, hopefully someone can help me. These are my tables: And these are the results I want to obtain: that the BRAND be printed only once and then the list...
asked by 05.06.2018 / 00:28
0
answers

Laravel 5.6 Eloquent Optimize A query

I need to optimize this in the model public function getPointStatsByUserId($id){ return array( 'total_win' => Trade::where('point' , '>', '0') ->where('user_id' , $id) ->sum('point'), 'to...
asked by 02.06.2018 / 03:44
2
answers

How to get user data related to the same model in Laravel

How can I get the data of another user, which is referenced from the same user model in Laravel? Keeping in mind that user has these columns in their migration: Schema::create('users', function (Blueprint $table) { $table->increm...
asked by 08.06.2018 / 13:21
0
answers

Convert Query SQL to use in Laravel 5.6

Good afternoon I'm using Laravel 5.6 and I want to make this sql query select e.id_asignacion, e.id_item, e.serie, id_funcionario, id_operacion, i.precio_unitario, min(nro_valorada) as minimo, max(nro_valorada) as Fin, count(e.id_item) as cant...
asked by 24.05.2018 / 23:36
3
answers

Using pluck laravel eloquent

I want to call a method of my laravel driver to return a JSON with the data that a DDBB. I have a Produtos table with the fields:    id, name, idCategoria, idGenero, stock A table Category with:    id, name, created And a Genre tab...
asked by 08.05.2018 / 17:02
1
answer

High register header and detail - Laravel

I am developing an order website and I have 2 order and order detail tables. I have created two models with laravel Order and OrderDetail. I have a form and pressing a button adds an article to the order: <div class="row"> @foreach ($pro...
asked by 11.05.2018 / 17:30
1
answer

Select distinct () with Join in Laravel 5.5

I've been working on an sql query that I want to replicate in Laravel 5.5 with eloquent, but I can not get it to work. I explain, this is my query in SQL: SELECT empresas.companyname_cny, empresas.ruc_cny, municipios.municipality_mty, ciudads...
asked by 28.04.2018 / 04:38
1
answer

Queries with Eloquent

How can I make a query with eloquent using Like and relate to another table? - What happens is that I'm looking for a profile of a user according to their skills and specialty, I do not know if it was the best way to do it, but it works for m...
asked by 08.04.2018 / 21:15