<?php namespace App\Http\Controllers;

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

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

		    function __construct() {    
				$this->table       = "transaksi";        
				$this->permalink   = "get_transaksi";    
				$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['api_status']==1){
                    foreach($result['data'] as $data){
                        $data->keranjang = DB::table('keranjang')->where('transaksi_id',$data->id)->get();
                        $data->keranjang_count = DB::table('keranjang')->where('transaksi_id',$data->id)->count();
                    }
                    
                    
                }
		    }

		}