Laravel. How to make a selection of fields?

There is a table giveaway, there is a column of a winner, winner_idrequesting user ID on the website. Need ID column winner_id was looking for the table users and was found on the website login username. How to do it correctly?
April 4th 20 at 13:15
1 answer
April 4th 20 at 13:17
The ratio of One to One (https://laravel.com/docs/6.x/eloquent-relationship... Add in the migration of a foreign key, and get giveaway->winner();
My dear, you yourself, then the documentation read? What side foreign key relationship? - esmeralda commented on April 4th 20 at 13:20
I just do that in migration

$table->foreign('winner_id')
->references('id')
->on('giveaway')
->onUpdate('cascade')
->onDelete('cascade');
 });
- Marcella.Bradtke71 commented on April 4th 20 at 13:23
@Herminia, and I think that after this start to work communication? - esmeralda commented on April 4th 20 at 13:26
@Fern.Bau, of course not) but he needs winner_id the table - Marcella.Bradtke71 commented on April 4th 20 at 13:29
@Fidel_Steub, the meaning of these messages is that the documentation gives a complete answer to your question, and point in duplicating it here no - Marcella.Bradtke71 commented on April 4th 20 at 13:32

Find more questions by tags Laravel