app/validations/MatchValidation.php
/**
  *Method is used to check valid teamids,avoid match between same team
  * @param array attributes Input request
  * @return array contains HTTP status code and status
  
*/
Method is used to check valid teamids,avoid match between same team
@param array attributes Input request
@return array contains HTTP status code and status
Method is used to check valid teamids avoid match between same team @param array attributes Input request @return array contains HTTP status code and status
public function validateInputs(array $attributes){
$teamId1 = (int)$attributes['team1_id'];
$teamId2 = (int)$attributes['team2_id'];
$scheduleTime = (string)$attributes['schedule_time'];
 if(empty($teamId1) || empty($teamId2) || empty($scheduleTime)){
 	return array('out' => false,'errorcode' => 400);
 }
 if($teamId1 == $teamId2){
  	return array('out' => false,'errorcode' => 406);	
 }
  	$out1 = $this->teamObj->getbyid($teamId1);
 	if(!count($out1)){
 		return array('out' => false,'errorcode' => 404);
 	}
 	$out2 = $this->teamObj->getbyid($teamId2);
 	 if(!count($out2)){
 		return array('out' => false,'errorcode' => 404);
 	}
 return array('out' => true,'errorcode' => 0);
}
public function validateInputs ( array $ attributes ) { $ teamId1 = ( int ) $ attributes [ 'team1_id' ] ; $ teamId2 = ( int ) $ attributes [ 'team2_id' ] ; $ scheduleTime = ( string ) $ attributes [ 'schedule_time' ] ; if ( empty ( $ teamId1 ) || empty ( $ teamId2 ) || empty ( $ scheduleTime ) ) { return array ( 'out' => false , 'errorcode' => 400 ) ; } if ( $ teamId1 == $ teamId2 ) { return array ( 'out' => false , 'errorcode' => 406 ) ; } $ out1 = $ this -> teamObj -> getbyid ( $ teamId1 ) ; if ( ! count ( $ out1 ) ) { return array ( 'out' => false , 'errorcode' => 404 ) ; } $ out2 = $ this -> teamObj -> getbyid ( $ teamId2 ) ; if ( ! count ( $ out2 ) ) { return array ( 'out' => false , 'errorcode' => 404 ) ; } return array ( 'out' => true , 'errorcode' => 0 ) ; }
Method is used to check valid teamids,avoid match between same team
 @param array attributes Input request
 @return array contains HTTP status code and status
Method is used to check valid teamids avoid match between same team @param array attributes Input request @return array contains HTTP status code and status