Questions tagged as 'relacionamento'

1
answer

How to force an Exception when trying to delete a Master record that already contains relationship in a Child Registry?

I have created the following structure in SQL Server: UsingEntityFrameworkwithCode-First,theclasseslooklikethis:[Table("Master")] public class Master { [Key] [DatabaseGenerated(DatabaseGeneratedOption.None)] public int Id { get; s...
asked by 18.03.2015 / 16:58
1
answer

Adding values from a column of a Ruby related entity

I'm trying to build an application in Rails. In it I have a resource where the user registers products and sales. The relationship is too many, to pass an array of products to sales I did the following def sale_params params.require(:sale)...
asked by 01.08.2016 / 19:31
2
answers

Retrieving value in the pivot table as the property of a part of the relationship

I have the manyToMany relationship between Grupos and Usuarios and a pivot table grupo_usuario that stores the keys and an extra aprovador , Boolean field, which serves to indicate if the user in the relationship can...
asked by 05.08.2015 / 01:04
2
answers

Database overload when deleting rows with relationships?

Good afternoon everyone! I have a question, and I would like to hear your comments. I'm building a system in php + laravel . I have relationships between tables, for example: Users->Roles .    It is assumed that there are...
asked by 18.05.2016 / 22:10
1
answer

How to Order Related Model Data?

I have the following relationship in my application: Template Customer : class Cliente extends Model { protected $table = 'clientes'; public function Usuario(){ return $this->hasMany('App\Models\Admin\Usuario', 'id_cli...
asked by 18.04.2016 / 15:54
1
answer

SQL SERVER - RELATIONSHIP 1: N

I have two tables: books and publishers . Their relationship was defined as follows, a book can have a publisher and a publisher can be in several books, ie 1: N. I learned that the foreign key (FK) should be in table N, in this case, i...
asked by 26.02.2018 / 22:00
1
answer

RelationsShips Larval 5.4 Accessing search data with with?

I have a relationship of One To Many , I wanted to know how do I access data from the two tables. See: Album::with('imagemAlbums')->where('departamento_id', $id)->get(); Return from dd()    Now in my View...
asked by 24.08.2017 / 02:07
1
answer

How to update the pivot in LARAVEL 4 using the UPDATE method?

I have two Models that are linked, through belongsToMany , to a relationship table N: N. So the structure is arranged as follows: classPermissaoextendsEloquent{publicfunctionniveis(){return$this->belongsToMany('Nivel','niveis_perm...
asked by 10.06.2015 / 14:29
1
answer

Consultations with laravel

I recently started with laravel and I have a terrible doubt. I've done several google searches that only left me more confused yet. I have a news table and a photo table. Each news item has several photos. In home you have to see the last two...
asked by 05.07.2017 / 14:53
1
answer

Many relationship to many ASP.NET Entity Framework

I'm having trouble making the relationship between my tables using EF. At the time of creating a Maintenance Order, I need to list the data registered in other tables, such as Equipment, Tasks and Person, as I try to represent in the class be...
asked by 29.10.2016 / 03:15