mercredi 29 janvier 2020

how can i submit the employee table id (auto increment) to the user table under the employee_id on form submit

public function store(Request $request)
{

     Employees::create([

        'first_name'=>$request['first_name'],
        'last_name'=>$request['last_name'],
        'email'=>$request['email'],
        'contact_no'=>$request['contact_no'],
        'join_date'=>$request['join_date'],
        'date'=>$request['date'],
        'employee_no'=>$request['employee_no'],
        'no'=>$request['no'],
        'profile'=>$request['profile'],
        'dob'=>$request['dob'],
        'leave_eligible_date'=>$request['leave_eligible_date'],
        'leave_eligible_date'=>$request['leave_eligible_date'],
        'employee_type_id'=>$request['employee_type_id'],
        'employee_designation_id'=>$request['employee_designation_id'],
        'employee_department_id'=>$request['employee_department_id'],
        'organization_hierarchy'=>$request['organization_hierarchy'],
        'direct_contact_person_id'=>$request['direct_contact_person_id'],
        'status'=>$request['status']
    ]);

i want to send the Employee table id to the user table under the employee_id column on form submit

      User::create([
        'name'=>$request['first_name'],
        'email'=>$request['email'],
        'photo'=>$request['profile'],   
        'employee_id'=>$request['????'], // i want send this line
        'password'=>Hash::make($request['password'])
     ]);
}

The above code will insert the data into two tables but i want the employee table id which is auto increment to be inserted into the user table under the employee_id column on form submit.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3aWGhLd
via IFTTT

Aucun commentaire:

Enregistrer un commentaire