Questions tagged as 'eloquent'

3
answers

Inquiry about Laravel and Eloquent

I have a form with two select and two date fields, when I click on the button it makes me a query with the value of the two select and "whereBetween" between the dates, is there any way of doing that I only consult according to the select in tho...
asked by 14.02.2018 / 13:18
2
answers

make consultation with three tables in Eloquent Laravel

I have three tables that are the following users , maps , bookmarks A user has several maps a map has several markers What I am trying to do is show the markers that belong to the maps of the user who has logged in. This is...
asked by 22.10.2018 / 16:47
2
answers

Two columns with the same name

I have a problem with the query I'm doing, when joining two tables with a join I do not see a column because they have the same name. I tried to use a select as I normally do in sql but it still does not appear. $user = DB::table('app_registro...
asked by 19.02.2018 / 14:29
3
answers

Use the OR clause (||) in Eloquent queries in Laravel

Greetings community I have a doubt and I do not know how it is resolved ... How well we know if I wanted to make a query that had an OR clause in SQl would be something like this: Select * tabla where campoA='1' || campoA='2' The issue i...
asked by 06.08.2018 / 22:17
2
answers

SQLSTATE [42S22]: Column not found: 1054 Unknown column LARAVEL 5.4

I can not access the relationship with with from the parent table to the daughter, she says:    SQLSTATE [42S22]: Column not found: 1054 Unknown column   'subComidas.comida_id' in 'where clause' (SQL: select * from    subComidas where...
asked by 19.10.2017 / 06:00
1
answer

Query two different tables and show in the blade view?

Table 1 news Table 2 notes The following controller makes a query to the news table. The search engine makes the query with three different fields. The question is how to make the query from the table (notes) at the same time as the news t...
asked by 06.04.2018 / 22:37
2
answers

Duda laravel eloquent sql

I'm new to laravel and I have a couple of problems about eloquent . I have the following code. $usuario = DB::table('user') ->select('user.id','user.name', 'user.email') ->join('user_dep', 'user_dep.user_id', '=', 'user....
asked by 25.06.2018 / 08:21
1
answer

Sort unpaged list in php laravel

I'm organizing some list objects by their names, but I want to sort them without having to page them. The code that I have is the following: if ($filter['sort'] == 'name_asc'){ return Employee::orderBy('first_name', 'ASC')->paginate(100...
asked by 03.10.2018 / 00:56
1
answer

Laravel and the formatting of dates

Gentlemen I am making a query to a table with Eloquent ... and between the fields that I want to consult this one of date, as I do so that in full consultation to bring the date formatted? Ex: $consulta=Ejemplo::select('fecha')->find($id);...
asked by 20.02.2018 / 15:04
2
answers

Laravel 5 create Table and Self-Referenced model (self Referencing)

How do I create a table autor referenced and how do I do the relationship in the same model?: Example: Tengo una tabla: Categoria Campos: categoria_id, nombre, categoria_padre It translates that a category (parent) can have many...
asked by 16.02.2018 / 05:35