Questions tagged as 'eloquent'

1
answer

Add new value to an enum type field in Laravel

I am working with migrations in Laravel and I have a partners table that has a type attribute of type enum with the following values: $table->enum('type', ['cliente', 'proveedor', 'empleado', 'transportadora'])->nullable(); What I nee...
asked by 30.08.2018 / 22:40
1
answer

laravel 5.5, multiple drivers in one or more views?

Greetings wherever you are on that side of the receiver, I have weeks learning about this giant that is laravel (5.5), I have a system to develop during my degree work, but I have a big failure, I can not find or not how to pass the methods of t...
asked by 06.10.2018 / 00:43
2
answers

Query eloquent two tables

I have a table of products that has the fields:    id, name, price, category_id And I have the category table with the fields:    id, name I am trying to make it return all the fields in the product table and instead of showing me...
asked by 07.05.2018 / 19:21
2
answers

Problem with query like

Good morning, I have this query that is like a search engine, only for products where the brand is "strong" .. in the parameter $ word, it can only bring a description of the product or code. When I send a description of the product, the sear...
asked by 27.12.2017 / 14:03
1
answer

Why do not relations work for me in Laravel 5.4.2?

Hello friends, my problem is the following, for some days now I have been planning the relations of the game that I am doing with PHP using Laravel 5.4 and the following problem arises when creating users: I have two Tables: users and charact...
asked by 14.08.2017 / 17:23
1
answer

Laravel 5.6: Get sum of a field from a table using sum and where

I have the following code: $tiendas=Tienda::with('factura.cuenta.cuentapago.pago') ->where('cuenta.id_tcuenta','=','1') ->join('ventas.factura', 'tienda.id', '=', 'factura.id_tienda')...
asked by 03.09.2018 / 23:24
1
answer

Laravel / Eloquent query between unrelated tables (Many to many)

My problem is that I have a many to many relationship between the subject and teacher table, therefore, I have a detail or intermediate table ( teacherSubject ). I must show in Teacher the subject blade teacher that they are related...
asked by 14.06.2018 / 00:08
3
answers

Error when consulting with eloquent in laravel 5.6

I'm trying to show data from a table that is related and I'm using Laravael Eloquent for the query. but it generates the sgt error:    SQLSTATE [42S22]: Column not found: 1054 Unknown column 'a.name' in       'where clause' (SQL: select co...
asked by 27.09.2018 / 01:04
1
answer

Laravel (5.4) Parse error: syntax error, unexpected '-' (T_OBJECT_OPERATOR)

Description Last days they answered me in another question that could implement whereHas to make a query to two different tables. In this case the table noticias and notas same that does not let me receive the data in the...
asked by 08.04.2018 / 20:36
2
answers

Add data from an array obtained from a WhereIn laravel 5.6

Good morning friends, I have this question of how to add these elements taken from several queries The result that shows me is this: [{"s1":15},{"s2":12},{"s3":5},{"s4":7}] What I need is to add them and then pass them to a view. This is...
asked by 04.09.2018 / 01:46