src/Generator.php
public function getPhone($state_code = null, $zip = null, $include_toll_free = false)
	{
		if (!empty($zip)) {
			$areacodes = Zipcode::where('zip', $zip)->orderByRaw(Database::random())->first()->area_codes;
		} else {
			// Get a random state if state not provided
			$state_code = !empty($state_code) ? $state_code : $this->getState()->code;
			
			// Get area codes appropriate for this state
			$areacodes = Zipcode::where('state_code', $state_code)->orderByRaw(Database::random())->first()->area_codes;
		}

		// Get list of valid area codes for the state/zip code
		$code_list = explode(',', $areacodes);

		// @codeCoverageIgnoreStart
		// Add some toll free numbers into the mix.
		if ($include_toll_free === true) {
			$code_list[] = 800;
			$code_list[] = 888;
			$code_list[] = 877;
			$code_list[] = 866;
			$code_list[] = 855;
		}
		// @codeCoverageIgnoreEnd
		
		// Get a random area code from valid area codes
		$areacode	= $this->fromArray($code_list);
		$prefix		= rand(100, 999);
		$number		= rand(1, 9999);
		
		return $areacode . '-' . $prefix . '-' . str_pad($number, 4, '0', STR_PAD_LEFT);
	}
public function getPhone($state_code = null, $zip = null, $include_toll_free = false)
	{
		if (!empty($zip)) {
			$areacodes = Zipcode::where('zip', $zip)->orderByRaw(Database::random())->first()->area_codes;
		} else {
			// Get a random state if state not provided
			$state_code = !empty($state_code) ? $state_code : $this->getState()->code;
			
			// Get area codes appropriate for this state
			$areacodes = Zipcode::where('state_code', $state_code)->orderByRaw(Database::random())->first()->area_codes;
		}

		// Get list of valid area codes for the state/zip code
		$code_list = explode(',', $areacodes);

		// @codeCoverageIgnoreStart
		// Add some toll free numbers into the mix.
		if ($include_toll_free === true) {
			$code_list[] = 800;
			$code_list[] = 888;
			$code_list[] = 877;
			$code_list[] = 866;
			$code_list[] = 855;
		}
		// @codeCoverageIgnoreEnd
		
		// Get a random area code from valid area codes
		$areacode	= $this->fromArray($code_list);
		$prefix		= rand(100, 999);
		$number		= rand(1, 9999);
		
		return $areacode . '-' . $prefix . '-' . str_pad($number, 4, '0', STR_PAD_LEFT);
	}
Return a phone number

@param null $state_code
@param null $zip
@param bool $include_toll_free
@return string