Questions tagged as 'eloquent'

1
answer

Use of the WHERE NOT IN in Laravel

I want to obtain the books without repeating that there is in the table book but if they are not already added to the table lineapedido with the client that is making the query. Instead of that, with the following code I get the books that are i...
asked by 26.03.2018 / 22:16
0
answers

when I use join I skipped many records using eloquent with laravel

I am presenting an inconvenience regarding an eloquent query with laravel, the problem is that when I use the direct select it brings all the normal records without problem, but when using join to bring in this case I bring municipalities and de...
asked by 12.02.2018 / 18:44
0
answers

Link 3 models in Eloquent

I am developing a system that, among other functions, will show the grades of a school, so I must manage levels, courses, subjects, evaluations and grades. Now the subject is the following; I do not know how I can relate the models of Student...
asked by 04.01.2018 / 05:53
1
answer

Get the current model you are using Eloquent Laravel

I am making an implementation of a plugin, but I need to obtain the current model that laravel is using when performing some operation ... Is there a function or way to "intercept" the model that Eloquent is working on at that moment?     
asked by 18.12.2017 / 23:52
1
answer

How to delete a record of a collection?

At the time of returning the result of a query I want to debug the result, my intention is, if it does not comply with the condition that is eliminated from the matrix, however all are eliminated, this is an example of the result: { "0": {...
asked by 15.11.2017 / 17:44
0
answers

How can I express the following Query to eloquent?

SELECT tipo_entidad.id, tipo_entidad.descripcion, tipo_entidad.vigente FROM tipo_entidad INNER JOIN estado AS e ON e.valor = tipo_entidad.vigente WHERE tipo_entidad.vigente=e.valor and e.tabla = 'VIGENCIA' AND (tipo_entidad.descripcion LIKE '%ad...
asked by 09.11.2017 / 04:00
0
answers

How to edit and delete in One to Many relationships with eloquent in laravel 5.1?

I have a 3 tables which have the following relationships: Events Table: public function modalitys() { return $this->hasMany('Deportes\Models\Modality', 'events_id'); } Modality Table: public function disc...
asked by 29.10.2017 / 13:13
0
answers

Convert to eloquent

I have this query that making it run in workbench returns me well SELECT msg.id, msg.messages,msg.readed, COUNT(cmt.message_id) as total FROM messages as msg inner join comments as cmt where cmt.message_id = msg.id; or this one that also re...
asked by 14.10.2017 / 21:17
1
answer

Pass MySQL query to Eloquent

Good I would like to pass a query to Eloquent, but it does not work for me. I think it's because of the subquery, but come on, I do not know. Greetings and thanks in advance Here I leave my Eloquent query which is not well done: public func...
asked by 17.10.2017 / 19:52
1
answer

Codeigniter 3.1.4 with Eloquent 5.4 Service

Controller Services to get AWARDS including count and paged This is my service controller, with CODEIGNITER 3.4 and ELOQUENT 5.4 public function __construct() { parent::__construct(); header('Content-Type: application/json');...
asked by 12.05.2017 / 19:41