app/Http/Controllers/ItemRequestController.php
/*
    * Cancel Request by company user
    * @solder_request_id
    */
Cancel Request by company user
@solder_request_id
Cancel Request by company user @solder_request_id
public function cancelRequest( Request $request ){
       try{
           $companyUser = $request->user();
           if(!$companyUser || !$companyUser->hasRole('company'))
               throw new Exception("You need to logged in as company");
           if( !$request->input('solder_request_id'))
               throw new Exception("Must be need request ID");
           $currentRequest = SolderItemRequest::find( $request->input('solder_request_id'));
           if( !$currentRequest )
               throw new Exception("Sorry didn't find your request data");
           $currentRequest->status = 3;
           $currentRequest->save();
           $actionItem = SolderKits::find( $currentRequest->solder_kit_id );
           $actionItem->status = 3; 
           $actionItem->save();
           $actionItem->soldier_device_id = User::find($actionItem->user_id)->device_id;
           return ['success'=>true ,'message'=>'Item request cancel!', 'data'=>$actionItem];
       }catch (Exception $e){
           return ['success'=>false, 'message'=>$e->getMessage()];
       }
   }
public function cancelRequest ( Request $ request ) { try { $ companyUser = $ request -> user ( ) ; if ( ! $ companyUser || ! $ companyUser -> hasRole ( 'company' ) ) throw new Exception ( " You need to logged in as company " ) ; if ( ! $ request -> input ( 'solder_request_id' ) ) throw new Exception ( " Must be need request ID " ) ; $ currentRequest = SolderItemRequest :: find ( $ request -> input ( 'solder_request_id' ) ) ; if ( ! $ currentRequest ) throw new Exception ( " Sorry didn't find your request data " ) ; $ currentRequest -> status = 3 ; $ currentRequest -> save ( ) ; $ actionItem = SolderKits :: find ( $ currentRequest -> solder_kit_id ) ; $ actionItem -> status = 3 ; $ actionItem -> save ( ) ; $ actionItem -> soldier_device_id = User :: find ( $ actionItem -> user_id ) -> device_id ; return [ 'success' => true , 'message' => 'Item request cancel!' , 'data' => $ actionItem ] ; } catch ( Exception $ e ) { return [ 'success' => false , 'message' => $ e -> getMessage ( ) ] ; } }
Cancel Request by company user
 @solder_request_id
Cancel Request by company user @solder_request_id
// cancel and re-usable