public function insert($data) { // Validating data $validator = Validator::make($data, UserRole::createrules()); // If there are no errors in data if (!$validator->fails()) { // Create UserRole $userRole = UserRole::create($data); // Passing data to response service return $this->responseService->returnMessage($userRole, 'UserRole was not Inserted.'); } else { // Data has errors // Passing errors to response service return $this->responseService->errorMessage($validator->errors()->all()); } }