dimanche 4 décembre 2016

How to make reverse relationship for multiple Role in Laravel

i`m using Entrust and has 3 types of users (Admin,Moderator, Player); I have 2 tables: Users and Hall (Game place); All this users (Admin, Moderator, Player) are stored in the Users table; so Admin and Moderator can make Hall; Users connected with hall_id;

I did relationship in Hall with Users for Owner_Id (who created Hall);

and i want do same back for Players;

Users: when i did something in migration like $table->foreign('hall_id')->references('id')->on('hall') => i have error; Of course I do not forget to register unsigned() and hall_id is integer;

[Illuminate\Database\QueryException] SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (bingo.#sql-396_1dc, CONSTR AINT users_hall_id_foreign FOREIGN KEY (hall_id) REFERENCES hall (id )) (SQL: alter table users add constraint users_hall_id_foreign foreig n key (hall_id) references hall (id))


I want get about hall information of Players



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2gWaEGj
via IFTTT

Aucun commentaire:

Enregistrer un commentaire