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

Related Posts

Codeigniter : Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE) in Laravel project

I’m getting following error: **Parse error: syntax error, unexpected ‘const’ (T_CONST), expecting variable (T_VARIABLE)** Note : It’s working in local but facing issue in production server. private…

Firebase receive notification while tab is active or on focus

What i want is to be able to perform an action when a user receives a notification while the browser is open and tab is active or…

Laravel’s alias loader does not find class

We have a legacy project that we cannot update and we need to make some changes in symfony’s Response.php in vendor. We have solved this by copying…

Laravel 5 – generic document management

I have a system where you can create different types of unique documents. For instance, one document is called Project Identified and this expects certain inputs. Originally,…

Laravel Nova limit the results in indexQuery

I ran intro a situation where I need to limit the results of a resource to only 3 results. To be more specific, based on the logged…

Auditoria en laravel 5.8 [closed]

Cómo puedo automatizar el registro de actividades de un usuario en laravel? Si un usuario ingresa a un app de laravel, debo guardar toda su actividas, a…

Leave a Reply

Your email address will not be published.