app/Http/Controllers/KitItemController.php
/*
     * Update central item table
     * Dummy function
     */
Update central item table
Dummy function
Update central item table Dummy function
public function updateCentralItems(){
        $kitItems = KitItem::where(['status'=>0])->orderBy('created_at', 'desc')->get();
        if(count($kitItems) > 0 ){
            foreach($kitItems as $item){
                $itemType = ItemType::find($item->item_type_id);
                $centralItems = CentralItems::where(['item_slug'=>$itemType->type_slug])->first();
                if($centralItems){
                    $centralItems->items = $centralItems->items+1;
                }else{
                    $centralItems = new CentralItems();
                    $centralItems->central_id = 1;
                    $centralItems->item_slug = $itemType->type_slug;
                    $centralItems->item_name = $itemType->type_name;
                    $centralItems->items = 1;
                }
                $centralItems->save();
            }
        }
    }
public function updateCentralItems ( ) { $ kitItems = KitItem :: where ( [ 'status' => 0 ] ) -> orderBy ( 'created_at' , 'desc' ) -> get ( ) ; if ( count ( $ kitItems ) > 0 ) { foreach ( $ kitItems as $ item ) { $ itemType = ItemType :: find ( $ item -> item_type_id ) ; $ centralItems = CentralItems :: where ( [ 'item_slug' => $ itemType -> type_slug ] ) -> first ( ) ; if ( $ centralItems ) { $ centralItems -> items = $ centralItems -> items + 1 ; } else { $ centralItems = new CentralItems ( ) ; $ centralItems -> central_id = 1 ; $ centralItems -> item_slug = $ itemType -> type_slug ; $ centralItems -> item_name = $ itemType -> type_name ; $ centralItems -> items = 1 ; } $ centralItems -> save ( ) ; } } }
Update central item table
 Dummy function
Update central item table Dummy function