app/Http/Controllers/Admin/EmployeeController.php
/**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \App\Employee $employee
     * @return \Illuminate\Http\Response
     */
Update the specified resource in storage.
Update the specified resource in storage .
public function update(UpdateEmployeeRequest $request, Employee $employee)
    {
        $requestedData = collect($request->validated());
        $employee->user->update($requestedData->only('name', 'email', 'password')->toArray());
        $employee->user->assignRole($request->role);
        $employeeProfile = $requestedData->except('name', 'email', 'password')->toArray();
        $employee->update($employeeProfile);
        return redirect()->route('admin.employees.index')->withSuccess('Employee updated successfully');
    }
public function update ( UpdateEmployeeRequest $ request , Employee $ employee ) { $ requestedData = collect ( $ request -> validated ( ) ) ; $ employee -> user -> update ( $ requestedData -> only ( 'name' , 'email' , 'password' ) -> toArray ( ) ) ; $ employee -> user -> assignRole ( $ request -> role ) ; $ employeeProfile = $ requestedData -> except ( 'name' , 'email' , 'password' ) -> toArray ( ) ; $ employee -> update ( $ employeeProfile ) ; return redirect ( ) -> route ( 'admin.employees.index' ) -> withSuccess ( 'Employee updated successfully' ) ; }
Update the specified resource in storage.
Update the specified resource in storage .
//