app/Http/Controllers/Admin/CategoryController.php
//This function change the status of the category
This function change the status of the category
This function change the status of the category
public function changeStatus(Request $request){
        $categoryIds = $request->dataForController;
        $sl = 0;
        foreach($categoryIds as $id){
            $cat_id = Category::find($id);
            $cat_id->status = $request->status;
            $cat_id->save();
            $sl++;
        }
        $success = $sl > 0;
        return response()->json(['success'=> $success, 'total' => $sl]);
    }
public function changeStatus ( Request $ request ) { $ categoryIds = $ request -> dataForController ; $ sl = 0 ; foreach ( $ categoryIds as $ id ) { $ cat_id = Category :: find ( $ id ) ; $ cat_id -> status = $ request -> status ; $ cat_id -> save ( ) ; $ sl ++ ; } $ success = $ sl > 0 ; return response ( ) -> json ( [ 'success' => $ success , 'total' => $ sl ] ) ; }
This function change the status of the category
This function change the status of the category