Skip to content
This repository has been archived by the owner on Jan 13, 2024. It is now read-only.

Latest commit

 

History

History
43 lines (37 loc) · 1.19 KB

how-to-inject-postdata.md

File metadata and controls

43 lines (37 loc) · 1.19 KB

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

Products Table - products

Field Name Description
id int(PK)
created_at timestamp
name varchar(255)
description text
status varchar(25)

Make a pre-custom-data at Create A Data

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

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

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