laravel - Faker 类(数据填充)

2 篇文章 0 订阅

Faker自带生成的是英文,但是 [ click here ! ] 中文假数据 ,可以为你配置中文数据。

<?php

namespace Faker;

/**
/**
 * # 名字
 * @property string $name                                       // Lilyan Armstrong
 * @method string name(string $gender = null)
 * @property string $firstName                                  // Margarette
 * @method string firstName(string $gender = null)
 * @property string $firstNameMale                              // Marcos
 * @property string $firstNameFemale                            // Dana
 * @property string $lastName                                   // Larson
 *
 * # 标题
 * @property string $title                                      // Mrs. | Miss |  Mr.
 * @method string title(string $gender = null)
 * @property string $titleMale                                  // Mr.    | Dr.
 * @property string $titleFemale                                // Prof.  | Dr.
 *
 * # 城市、街道名
 * @property string $citySuffix                                 // ville | shire | port
 * @property string $streetSuffix                               // Lock | Skyway  | Crest
 * @property string $buildingNumber
 * @property string $city                                       // 29285 | 8366
 * @property string $streetName                                 // Myleneberg | New Isaacville
 * @property string $streetAddress                              // 77996 Harris Motorway Suite 662
 *
 * # 邮编
 * @property string $postcode                                   // 41245-1599 | 79607-9316
 * @property string $address                                    // 9023 Merritt Radial Suite 708  New Lunamouth, MO 72638
 *
 * # 国家
 * @property string $country                                    // Costa Rica | Grenada
 *
 * # 经纬度
 * @property float  $latitude                                   // -19.069999  | 59.078801
 * @property float  $longitude                                  // 47.245569 | -26.502263
 *
 * # 编码(物品、书)
 * @property string $ean13                                      // 1862447703024  |  9942016771929
 * @property string $ean8                                       // 28748939
 * @property string $isbn13                                     // 9784072491881
 * @property string $isbn10                                     // 190748308X
 *
 * # 电话号码
 * @property string $phoneNumber                                // 559.854.2400 | 651-796-0755 | 1-439-780-5439 x52199
 *
 * # 公司
 * @property string $company                                    // Douglas, Hyatt and Kuvalis | Kerluke-Wintheiser
 * @property string $companySuffix                              // PLC
 * @property string $jobTitle                                   // Landscape Architect | Aircraft Mechanics OR Aircraft Service Technician
 *
 * # 信用卡
 * @property string $creditCardType                             // MasterCard | Visa  #填入method creditCardNumber的$type选项
 * @property string $creditCardNumber                           // 4485239422853283
 * @method string creditCardNumber($type = null, $formatted = false, $separator = '-') // 2520-1949-1124-6187 | 5423-2108-8541-4824
 * @property \DateTime $creditCardExpirationDate                // 10/19 | 03/20
 * @property string $creditCardExpirationDateString
 * @property array $creditCardDetails
 * @property string $bankAccountNumber                          // 49403347662
 * @method string iban($countryCode = null, $prefix = '', $length = null)
 * @property string $swiftBicNumber                             // JKIRWA5KO12 | MAMPMHSZ790
 * @property string $vat
 *
 * # 单词、语句、text
 * @property string $word                                       // dolorem
 * @property string|array $words
 * @method string|array words($nb = 3, $asText = false)
 * @property string $sentence                                   // Possimus non atque aliquid non dolores unde vel voluptatum.
 * @method string sentence($nbWords = 6, $variableNbWords = true)
 * @property string|array $sentences
 * @method string|array sentences($nb = 3, $asText = false)
 * @property string $paragraph                                  // Sit labore et est ad optio nihil eveniet. Aut sed accusamus doloremque reprehenderit dolorem voluptate laudantium neque. Inventore vel rem autem consequatur quaerat consequatur.
 * @method string paragraph($nbSentences = 3, $variableNbSentences = true)
 * @property string|array $paragraphs
 * @method string|array paragraphs($nb = 3, $asText = false)
 * @property string $text                                       // Molestias ea dolore non placeat consectetur debitis. Ut nihil nulla vitae id. Maiores reiciendis ut quis suscipit fugit et. Non adipisci perferendis dolorum fugit.
 * @method string text($maxNbChars = 200)
 *
 * @method string realText($maxNbChars = 200, $indexSize = 2)   // Alice. 'And where HAVE my shoulders got to? And oh, my poor little thing was waving its tail about in the middle, nursing a baby; the cook was busily stirring the soup, and seemed not to lie down on.
 *
 * # 邮箱、域名
 * @property string $email                                      // ellie93@wisozk.info
 * @property string $safeEmail                                  // wkuhn@example.com | vfeil@example.org
 * @property string $freeEmail                                  // anjali89@hotmail.com | kirk58@gmail.com
 * @property string $companyEmail                               // kemmer.elvera@tremblay.com
 * @property string $freeEmailDomain                            // gmail.com
 * @property string $safeEmailDomain                            // example.net | example.org
 * @property string $userName                                   // kerluke.raoul | corrine33
 * @property string $password                                   // hCCfg:w#<"uSFS}X~
 * @method string password($minLength = 6, $maxLength = 20)
 * @property string $domainName                                 // braun.biz | schumm.com
 * @property string $domainWord                                 // macejkovic | collins
 *
 * # IP
 * @property string $tld                                        // com
 * @property string $url                                        // http://ferry.com/
 * @property string $slug                                       // commodi-et-ipsa-vitae-ut | quia-voluptatibus-vero-mollitia-saepe-quia-modi
 * @method string slug($nbWords = 6, $variableNbWords = true)
 * @property string $ipv4                                       // 114.42.33.191
 * @property string $ipv6
 * @property string $localIpv4
 * @property string $macAddress                                 // 26:89:2F:1F:64:C6
 *
 * # 时间
 * @property int       $unixTime                                // 1312079471
 * @property \DateTime $dateTime                                // 1974-03-07 14:24:22
 * @property \DateTime $dateTimeAD                              // 1860-01-10 20:13:07
 * @property string    $iso8601                                 // 1986-12-05T15:37:34+0800
 * @property \DateTime $dateTimeThisCentury                     // 1969-11-14 22:51:12
 * @property \DateTime $dateTimeThisDecade
 * @property \DateTime $dateTimeThisYear
 * @property \DateTime $dateTimeThisMonth
 *
 * # 年月
 * @property string    $amPm                                    // am | pm
 * @property string    $dayOfMonth                              // 04
 * @property string    $dayOfWeek
 * @property string    $month
 * @property string    $monthName
 * @property string    $year
 * @property string    $century                                 // XVII
 * @property string    $timezone                                // Atlantic/Madeira | Asia/Anadyr
 * @method string amPm($max = 'now')
 * @method string date($format = 'Y-m-d', $max = 'now')
 * @method string dayOfMonth($max = 'now')
 * @method string dayOfWeek($max = 'now')
 * @method string iso8601($max = 'now')
 * @method string month($max = 'now')
 * @method string monthName($max = 'now')
 * @method string time($format = 'H:i:s', $max = 'now')
 * @method int unixTime($max = 'now')
 * @method string year($max = 'now')
 * @method \DateTime dateTime($max = 'now', $timezone = null)
 * @method \DateTime dateTimeAd($max = 'now', $timezone = null)
 * @method \DateTime dateTimeBetween($startDate = '-30 years', $endDate = 'now')
 * @method \DateTime dateTimeInInterval($date = '-30 years', $interval = '+5 days', $timezone = null)
 * @method \DateTime dateTimeThisCentury($max = 'now', $timezone = null)
 * @method \DateTime dateTimeThisDecade($max = 'now', $timezone = null)
 * @method \DateTime dateTimeThisYear($max = 'now', $timezone = null)
 * @method \DateTime dateTimeThisMonth($max = 'now', $timezone = null)
 *
 * # 加密
 * @property string $md5
 * @property string $sha1
 * @property string $sha256
 * @property string $locale
 * @property string $countryCode
 * @property string $countryISOAlpha3
 * @property string $languageCode                               // ur | ro
 * @property string $currencyCode                               // TTD | SAR
 * @property boolean $boolean
 * @method boolean boolean($chanceOfGettingTrue = 50)
 *
 * # 随机数
 * @property int    $randomDigit                                // 1 | 7
 * @property int    $randomDigitNotNull
 * @property string $randomLetter                               // m | o
 * @property string $randomAscii
 * @method int randomNumber($nbDigits = null, $strict = false)
 * @method int|string|null randomKey(array $array = array())
 * @method int numberBetween($min = 0, $max = 2147483647)
 * @method float randomFloat($nbMaxDecimals = null, $min = 0, $max = null)
 * @method mixed randomElement(array $array = array('a', 'b', 'c'))
 * @method array randomElements(array $array = array('a', 'b', 'c'), $count = 1, $allowDuplicates = false)
 * @method array|string shuffle($arg = '')
 * @method array shuffleArray(array $array = array())
 * @method string shuffleString($string = '', $encoding = 'UTF-8')
 * @method string numerify($string = '###')
 * @method string lexify($string = '????')
 * @method string bothify($string = '## ??')
 * @method string asciify($string = '****')
 * @method string regexify($regex = '')
 * @method string toLower($string = '')
 * @method string toUpper($string = '')
 * @method Generator optional($weight = 0.5, $default = null)
 * @method Generator unique($reset = false, $maxRetries = 10000)
 * @method Generator valid($validator = null, $maxRetries = 10000)
 *
 * @method integer biasedNumberBetween($min = 0, $max = 100, $function = 'sqrt')
 *
 * # 操作系统名
 * @property string $macProcessor                               // U; Intel | Intel
 * @property string $linuxProcessor
 * @property string $userAgent
 * @property string $chrome
 * @property string $firefox
 * @property string $safari
 * @property string $opera
 * @property string $internetExplorer
 * @property string $windowsPlatformToken
 * @property string $macPlatformToken
 * @property string $linuxPlatformToken
 *
 * @property string $uuid                                       // e7ad30c3-bb3c-3760-a14f-4af14dc12504
 *
 * @property string $mimeType                                   // video/x-m4v | application/xproc+xml
 * @property string $fileExtension
 * @method string file($sourceDirectory = '/tmp', $targetDirectory = '/tmp', $fullPath = true)
 *
 * @method string imageUrl($width = 640, $height = 480, $category = null, $randomize = true, $word = null, $gray = false)
 * @method string image($dir = null, $width = 640, $height = 480, $category = null, $fullPath = true, $randomize = true, $word = null)
 *
 * # 颜色
 * @property string $hexColor                                   // #6b5a86
 * @property string $safeHexColor
 * @property string $rgbColor
 * @property array $rgbColorAsArray
 * @property string $rgbCssColor
 * @property string $safeColorName
 * @property string $colorName
 *
 * @method string randomHtml($maxDepth = 4, $maxWidth = 4)
 *
 */

更详细参考:https://www.cnblogs.com/love-snow/articles/7655450.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值