Home » Php » retrieving value that i just input

retrieving value that i just input

Posted by: admin October 26, 2017 Leave a comment

Questions:

hi im pretty new in laravel and i stumble upon some trouble passing my value to my input, heres the following code :

$user = User::updateOrCreate([
                'username' => $request->input('username'),
                'password' => $hasher->make($request->input('password')),
                'costumer_id' => $request->input('costumer_id'),
                'role_id' => $request->input('role_id')
                ]);

$costumer= Costumer::updateOrCreate([
                'id' => $user->costumer_id,
                'email' => $request->input('email'),
                'first_name' => $request->input('first_name'),
                'last_name' => $request->input('last_name'),
                'phone_number' => $request->input('phone_number'),
            ]);

$register = Sentinel::registerAndActivate($request->all());  

I want to pass the costumer_id that I just input to my id in customer table but I got an error saying Foreign key violation: 7 ERROR: insert or update on table "users" violates foreign key constraint "users_costumers_id_foreign"

can someone help me how do I do that? thanks in advance

Answers: