Skip to content

How To Inject A Post Data In Create/Update/Delete Data Process ​

Products Table - products ​

Field NameDescription
idint(PK)
created_attimestamp
namevarchar(255)
descriptiontext
statusvarchar(25)

Make a pre-custom-data at Create A Data ​

php
public function hook_before_add(&$postdata) {  
  //For example you want to override the status field
  $postdata['status'] = 'Active';
}

This method will be called once submitting a form in Create A Data.

Make A Pre-Custom-Data at Update A Data ​

php
public function hook_before_edit(&$postdata,$id) {  
  //For example you want to override the status field
  $postdata['status'] = 'Active';
}

This method will be called once submitting a form in Update A Data.

Make A Pre-Custom-Data at Delete A Data ​

php
public function hook_before_delete($id) {  
  //You want to delete all data of child table
  DB::table('OTHER_CHILD_TABLE')->where('FOREIGN_KEY',$id)->delete();  
}

This method will be called once delete button is clicked.

What's Next ​

Table Of Contents ​

Released under the MIT License.