Foreign key registration

3

Good morning

To start work on laravel 5.5, I have two tables, one where I have an administrative user, and another where voting users are added, when I register a voting user I see this error,

 SQLSTATE[HY000]: General error: 1364 Field 'user_id' doesn't have a
 default value (SQL: insert into usuarios ('nombre', 'apellido',
 'cedula', 'telefonos', 'direccion', 'barrio', 'lugar_votacion',
 'mesa_votacion', 'email', 'ciudad', 'updated_at', 'created_at') values
 (angelica, sarmiento, 4564654, 3274865, cra 27, cuba, ormaza, 30,
 [email protected], pereira, 2018-09-27 23:54:31, 2018-09-27
 23:54:31))

user_id is the foreign key that comes from the admin table, the error is obvious, although I am in session and the user exists no value is sent to that field, the question is ...

How can I make this field appear with the id of the user who is in session and is registering this information?

    
asked by zereft 28.09.2018 в 01:58
source

0 answers