Questions tagged as 'laravel-eloquent'

2
answers

Doubts with relationships in Eloquent

I am making a belongsToMany to retrieve several Users that are related to a Item . It returns me in the array all Users correctly, however I need to do hasOne of each User (I created in the model Us...
asked by 20.05.2015 / 04:42
2
answers

Get an inverse relationship with Laravel

I am creating a forum system that is divided by sections. Each section contains categories, each category contains topics. Ex: Administração _ |_Regras da do fórum |_Sugestões e críticas Aeromodelismo _...
asked by 17.02.2014 / 16:35
2
answers

Queries between tables with Eloquent - Laravel 5

Well, I have the following problem when using Laravel 5 in the table relationship: I have these 4 tables (hypothetical names to illustrate the problem): UsingtheLaravel5templatesI'velistedthemtogether:CompanyTemplatepublicfunctionpessoa(){...
asked by 21.03.2015 / 22:04
2
answers

How to create a Grouped List in Laravel 4 from an entity with self-relationship

I'm trying to create a select box com \Form::select() (grouped list) in Laravel 4 and I have the following entity: Items id = id do item nome = nome do item pai = fk dessa mesma entidade I have already created the model with hasMa...
asked by 12.12.2013 / 12:06
1
answer

Mounting a query with laravel

I'm studying the laravel structure from this ready-made example = > bestmomo . In the project there is the userRepository repository with the following structure: <?php namespace App\Repositories; use App\Models\User; class...
asked by 24.11.2017 / 19:48
1
answer

Conflicts with the ConfideUser class

In my User model, I left my protected $table = 'usuarios' and in auth.php the same thing, but when calling the save() method of Eloquent, it recognizes table ' users ' and not ' users ' as I instantiated. So, I renamed the t...
asked by 17.01.2014 / 20:23
1
answer

What is the simplest way to do an IS NULL with Eloquent?

I saw tutorials on the internet that the way you had to make a IS NULL is as follows: Remessa::where('campo', 'IS', DB::raw('NULL'))->get(); But I was wondering about this, because if an ORM is usually developed thinking of creati...
asked by 04.05.2016 / 17:37
1
answer

Self-relationship in Group table with Laravel and Eloquent?

I have a table of grupo with the fields:    id ( int not null auto-increment )       description ( varchar )       groupid ( int null ) How would it be: 1) the migration corresponding to this table? 2) the creati...
asked by 24.09.2016 / 00:36
2
answers

On-to-one relationship in auxiliary table using Laravel

In the application I'm working the database is built on the users part, as follows: user 1 -------> 1 user_address 1 <-------- 1 address In the user table there is no column that references the address. What exists...
asked by 05.01.2016 / 07:33
1
answer

Pick up the average of a field in relationship table many to many Laravel Eloquent

I have a Many to Many relationship and in the relationship table the "value" field. How do I bring the media to this field using Eloquent? Example: Tabela A a_id Relationship Table a_id c_id value Table C c_id The query in my...
asked by 04.07.2014 / 00:38