Questions tagged as 'eloquent'

2
answers

Problems with accents in Eloquent query using pluck ()

I have problems with an eloquent query when using the collection tool pluck The accent is perfectly preserved in the BDD Query using Eloquent $listFinal[].=FAQ::where("id",$ids)->get()->pluck('answer'); Final result prin...
asked by 10.07.2018 / 18:35
1
answer

Debugge eloquent queries in laravel

I make transactions with eloquent de laravel 5.5 and I would like to debug the real query for example: objeto::all(); and I would like to see the real query for example select * from objeto in the same way for insert and update     
asked by 08.05.2018 / 16:55
1
answer

Convert clause "In" sql to laravel 5.6

I need to be able to pass the following query Sql containing the clause "In" to eloquent in laravel 5.6 and that I could not perform. SELECT sum('monto_facturado') FROM 'peticiones' WHERE 'id_presupuesto' IN ( SELECT id...
asked by 07.05.2018 / 22:11
1
answer

Connect Eloquent ORM to MySQL through a port other than 3306

I have a couple of connections to each of them going to a different MySQL database, the issue is that one connects to a local server itself, but the other goes to a remote server and under "another port ", I handle the connections like this: $...
asked by 22.03.2018 / 23:28
1
answer

Insert in 2 different laravel tables?

I want to make an insert in 2 different tables of the database. I have the holiday table that stores the holidays and I have a calendar, in which calendar events must be saved to show it every time a vacation is approved, then I have: Contro...
asked by 20.02.2018 / 13:02
1
answer

Laravel ORM Consulting relationships

I have three tables and models related to each other and I need to consult the properties whose Environment.Name = 'Dormitorios' and PropertyEnvironment.Value = 2 : App\Property : id address etc Methods:...
asked by 01.03.2018 / 15:28
1
answer

Compare result query SQL Laravel with Int

I am programming in Laravel 5.5 and I need to compare a query with an integer to perform a verification. The code is as follows: $sum_=DB::table('eventos_tienen_trabajadores as ett') ->where('ett.id_trabajador', '=', $id) ->...
asked by 26.01.2018 / 05:28
1
answer

How can I handle this type of relationship in Eloquent de Laravel?

I know how to handle relationships like "One to Many" but when creating a new sale, what would be the best practice using Eloquent to save?     
asked by 17.01.2018 / 15:03
2
answers

validate if a record exists before inserting laravel 5.5

I am trying to make an insert in a table with a many-to-many relationship. My doubt is if there is any way to validate, if that relationship exists do not add it again this is the code that I use but I do not know if eloquent already brings some...
asked by 18.10.2017 / 23:35
1
answer

Compound primary key: Illegal offset type error in laravel 5

I am new to Laravel and I do not know how to solve this problem, which is as follows: I have a table like that on MySql: Table: propiedad_x_tipo Columns: **id_tipo_propiedad** int(11) **PK** **id_propiedad** int(11) **PK** As you can se...
asked by 22.09.2017 / 01:41