Syntax for updating data

Home Forums General Syntax for updating data

Viewing 4 reply threads
  • Author
    • #69991

      Good day guys!

      Could you help me please. I would like to update a field in the employee table in case date_of_birth was changed. I’d found employee update function, but I can’t use syntax in right way.

      There is a code:
      $this->erp-user->update ( [ ‘lalala’ => ‘dadada’ ] ) ;

      My field in DB is situated also in employee table. But this code does not work. Any chance you can give an estimate how to use it?

    • #70000

      This is my code inside class-employee.php, update employee function of hrm module.

      //update user einformed if license_date was changed
      if ( isset( $posted[‘license_date’] ) && $posted[‘license_date’] !== $this->erp_user->license_date ) {

      $this->erp_user->update( [ ‘user_id’ => $this->user_id, ‘einformed’ => ‘no’ ] );

      if ( is_wp_error( $result ) ) {
      return $result;

    • #70071

      Hello Gordian,

      It’s really tough to say specifically without knowing the complete scenario you have but make sure you are adding your code on the fillable to update the Eloquent model. Something like:

      protected $fillable = [

      You can also post it to our GitHub so that other developers can have a look on it.


    • #70102

      Thank you!

      Just to make it clear… I created a field in employees table. The name of field is ‘einformed’.
      I want this field to take parametr ‘no’ in case if posted date of birth (in the form) is not the same as it is in DB. So, ‘einformed ‘ variable doesn’t mentioned is the form. I’m trying to use it only in ‘update employee’ function.

      P.S. I’v added it to the employee model, but there is no success.

    • #70104

      thanks for your help! I did it. I deleted ‘einformed’ variable from Class Employee protected data.

Viewing 4 reply threads
  • The forum ‘General’ is closed to new topics and replies.

Contact Us

Reach out to us for any inquiry

You must enter full name
You must enter email
You must enter message

We received your query

We will reply to you very soon :)