Questions tagged as 'eloquent'

1
answer

Many-to-one consultation laravel

I have a doubt in a controller with a relation of many (Product) to one (Brand), I try to search in Product to show the relationship 'Brand' but apparently I have an error because when using where() to search In Product and then show the...
asked by 19.11.2018 / 13:04
1
answer

Insert multiple - Laravel

I come to you in search of an orientation, I am working with laravel 5.5, I am using some nested lists, like the ones in the following photo: In the first field I choose the server and in the second, it loads me a few instances from an...
asked by 08.11.2018 / 20:26
1
answer

Save an array in an Eloquent table

Hello, how could I save this request in a table called Cat_favoritas which the arrangement of categories comes from a checkbox array:3 [▼ "_token" => "mqBPCysHUomaBF52LUMisDvI4Ptx5ygYQL1MQOj3" "categoria" => array:3 [▼...
asked by 26.09.2018 / 19:14
1
answer

How to query Sql in eloquent laravel?

I have a query on MySQl: SELECT E.EXPE_varHR,E.EXPE_varDescripcion, T.TIPO_varDenominacion,T.TIPO_booSAP, (SELECT SUM(EXPE_intDiasTramite) FROM gen_expedientes EX INNER join gen_tipos TT on EX.TIPO_intId=TT.TIPO_intId WHERE EX.EXPE_varRaizH...
asked by 26.06.2018 / 15:20
2
answers

Multiple Relationship in Laravel 5

as I can make 2 tables with one, I explain, I have a table works and other projects, these two tables have in common a table called events, where I want to put as fk the id and type since they can be repeated the id (id 1 of works or projects fo...
asked by 12.01.2018 / 21:20
1
answer

Report between several tables with Eloquent Laravel

I have a many-to-many relationship between Users and Tasks    Users (id, name ..)       task_user (user_id, task_id)       Tasks (id, task, state) (STATE = finalized, process, delayed) I need to bring the number of total tasks per user...
asked by 20.12.2017 / 13:23
2
answers

Make a correct query of two tables

I'm having a problem with a query in Laravel where two tables are related: Empleados and Emergencias in a 1: N relationship. According to me, I have good relationships in my models that are the following. Employee class...
asked by 10.03.2017 / 16:26
0
answers

Laravel subqueries in query builder

I'm trying to understand how to create queries with subqueries in Query Builder. The problem is that the official documentation is extremely brief and not very explanatory in some specific points. In particular, the methods joinSub() and...
asked by 05.01.2019 / 19:12
1
answer

Scope in Laravel with related table

I'm stuck in a filter: These are my tables: My model for Movement public function factura() { return $this->belongsTo('App\Factura'); } public function cuenta() { return $this->belongsTo('App\Cuenta'); } public fu...
asked by 29.12.2018 / 23:58
1
answer

Laravel, call additional method of the Model in Eloquent query

In my Deegre model I have a method fullName () that returns string <?php namespace App; use Illuminate\Database\Eloquent\Model; class Deegre extends Model { public function fullName(){ $level = [ "1" => "Primer ",...
asked by 27.12.2018 / 17:40