<?php namespace App\Http\Controllers;

		use Session;
		use Request;
		use DB;
		use CRUDBooster;

		class ApiGetWaNotifController extends \crocodicstudio\crudbooster\controllers\ApiController {

		    function __construct() {    
				$this->table       = "wa_notif";        
				$this->permalink   = "get_wa_notif";    
				$this->method_type = "get";    
		    }
		

		    public function hook_before(&$postdata) {
		        //This method will be execute before run the main process

		    }

		    public function hook_query(&$query) {
		        //This method is to customize the sql query

		    }

		    public function hook_after($postdata,&$result) {
		        //This method will be execute after run the main process
                if($result['data']){
                    foreach($result['data'] as $data){
                        if($data->status_id==0){
                            DB::table('wa_notif')->where('id',$data->id)->update(['status_id'=>5]);
                        }
		            }
                }
		    }

		}