幽灵资源网 Design By www.bzswh.com
D:\phpStudy\WWW\api.douxiaoli.com\database\factories\ModelFactory.php D:\phpStudy\WWW\BCCKidV1.0\vendor\fzaninotto\faker\src\Faker\Generator.php
$factory->define(App\User::class, function (Faker\Generator $faker) { static $password; #定义假数据长什么样子 return [ 'name' => $faker->name, 'email' => $faker->unique()->safeEmail, 'password' => $password "htmlcode">php artisan thinker factory(‘App\User',10)->create();这个地方的引号是英文的,csdn编辑器原因,复制出来之后是中文的,记得改成英文。
那个10表示一次生成10个假数据。
数据库结果记录:
其他可用的东东:
/** * @property string $name * @method string name(string $gender = null) * @property string $firstName * @method string firstName(string $gender = null) * @property string $firstNameMale * @property string $firstNameFemale * @property string $lastName * @property string $title * @method string title(string $gender = null) * @property string $titleMale * @property string $titleFemale * * @property string $citySuffix * @property string $streetSuffix * @property string $buildingNumber * @property string $city * @property string $streetName * @property string $streetAddress * @property string $postcode * @property string $address * @property string $country * @property float $latitude * @property float $longitude * * @property string $ean13 * @property string $ean8 * @property string $isbn13 * @property string $isbn10 * * @property string $phoneNumber * * @property string $company * @property string $companySuffix * @property string $jobTitle * * @property string $creditCardType * @property string $creditCardNumber * @method string creditCardNumber($type = null, $formatted = false, $separator = '-') * @property \DateTime $creditCardExpirationDate * @property string $creditCardExpirationDateString * @property array $creditCardDetails * @property string $bankAccountNumber * @method string iban($countryCode = null, $prefix = '', $length = null) * @property string $swiftBicNumber * @property string $vat * * @property string $word * @property string|array $words * @method string|array words($nb = 3, $asText = false) * @property string $sentence * @method string sentence($nbWords = 6, $variableNbWords = true) * @property string|array $sentences * @method string|array sentences($nb = 3, $asText = false) * @property string $paragraph * @method string paragraph($nbSentences = 3, $variableNbSentences = true) * @property string|array $paragraphs * @method string|array paragraphs($nb = 3, $asText = false) * @property string $text * @method string text($maxNbChars = 200) * * @method string realText($maxNbChars = 200, $indexSize = 2) * * @property string $email * @property string $safeEmail * @property string $freeEmail * @property string $companyEmail * @property string $freeEmailDomain * @property string $safeEmailDomain * @property string $userName * @property string $password * @method string password($minLength = 6, $maxLength = 20) * @property string $domainName * @property string $domainWord * @property string $tld * @property string $url * @property string $slug * @method string slug($nbWords = 6, $variableNbWords = true) * @property string $ipv4 * @property string $ipv6 * @property string $localIpv4 * @property string $macAddress * * @property int $unixTime * @property \DateTime $dateTime * @property \DateTime $dateTimeAD * @property string $iso8601 * @property \DateTime $dateTimeThisCentury * @property \DateTime $dateTimeThisDecade * @property \DateTime $dateTimeThisYear * @property \DateTime $dateTimeThisMonth * @property string $amPm * @property int $dayOfMonth * @property int $dayOfWeek * @property int $month * @property string $monthName * @property int $year * @property int $century * @property string $timezone * @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 string 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 * @property string $currencyCode * @property boolean $boolean * @method boolean boolean($chanceOfGettingTrue = 50) * * @property int $randomDigit * @property int $randomDigitNotNull * @property string $randomLetter * @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 * @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 * * @property string $mimeType * @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 * @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) * */以上这篇laravel批量生成假数据的方法就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。
标签:
laravel,生成,假数据
幽灵资源网 Design By www.bzswh.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
幽灵资源网 Design By www.bzswh.com
暂无评论...
《魔兽世界》大逃杀!60人新游玩模式《强袭风暴》3月21日上线
暴雪近日发布了《魔兽世界》10.2.6 更新内容,新游玩模式《强袭风暴》即将于3月21 日在亚服上线,届时玩家将前往阿拉希高地展开一场 60 人大逃杀对战。
艾泽拉斯的冒险者已经征服了艾泽拉斯的大地及遥远的彼岸。他们在对抗世界上最致命的敌人时展现出过人的手腕,并且成功阻止终结宇宙等级的威胁。当他们在为即将于《魔兽世界》资料片《地心之战》中来袭的萨拉塔斯势力做战斗准备时,他们还需要在熟悉的阿拉希高地面对一个全新的敌人──那就是彼此。在《巨龙崛起》10.2.6 更新的《强袭风暴》中,玩家将会进入一个全新的海盗主题大逃杀式限时活动,其中包含极高的风险和史诗级的奖励。
《强袭风暴》不是普通的战场,作为一个独立于主游戏之外的活动,玩家可以用大逃杀的风格来体验《魔兽世界》,不分职业、不分装备(除了你在赛局中捡到的),光是技巧和战略的强弱之分就能决定出谁才是能坚持到最后的赢家。本次活动将会开放单人和双人模式,玩家在加入海盗主题的预赛大厅区域前,可以从强袭风暴角色画面新增好友。游玩游戏将可以累计名望轨迹,《巨龙崛起》和《魔兽世界:巫妖王之怒 经典版》的玩家都可以获得奖励。