最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

laravel批量生成假數(shù)據(jù)的方法

 更新時(shí)間:2019年10月09日 08:41:18   作者:SHUIPING_YANG  
今天小編就為大家分享一篇laravel批量生成假數(shù)據(jù)的方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
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;
 #定義假數(shù)據(jù)長(zhǎng)什么樣子
 return [
  'name' => $faker->name,
  'email' => $faker->unique()->safeEmail,
  'password' => $password ?: $password = bcrypt('test12345'),
  'api_token' => str_random(60),
  'remember_token' => str_random(10),
 ];
});

然后在命令行中運(yùn)行:

php artisan thinker 
factory(‘App\User',10)->create(); 

這個(gè)地方的引號(hào)是英文的,csdn編輯器原因,復(fù)制出來(lái)之后是中文的,記得改成英文。

那個(gè)10表示一次生成10個(gè)假數(shù)據(jù)。

數(shù)據(jù)庫(kù)結(jié)果記錄:

其他可用的東東:

/**
 * @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批量生成假數(shù)據(jù)的方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持腳本之家。

相關(guān)文章

  • Laravel 模型使用軟刪除-左連接查詢-表起別名示例

    Laravel 模型使用軟刪除-左連接查詢-表起別名示例

    今天小編就為大家分享一篇Laravel 模型使用軟刪除-左連接查詢-表起別名示例,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-10-10
  • PHP讓網(wǎng)站移動(dòng)訪問(wèn)更加友好方法

    PHP讓網(wǎng)站移動(dòng)訪問(wèn)更加友好方法

    在本文里我們給大家整理了關(guān)于PHP讓網(wǎng)站移動(dòng)訪問(wèn)更加友好的相關(guān)實(shí)例代碼以及相關(guān)知識(shí)點(diǎn),有需要的朋友們學(xué)習(xí)下。
    2019-02-02
  • PHPMailer發(fā)送郵件

    PHPMailer發(fā)送郵件

    PHPMailer是一個(gè)封裝好的PHP郵件發(fā)送類,支持發(fā)送HTML內(nèi)容的電子郵件,以及圖片附件,前提要設(shè)置好郵件服務(wù)器就能實(shí)現(xiàn)郵件發(fā)送功能。本文給大家分享PHPMailer發(fā)送郵件功能,一起看看吧
    2016-12-12
  • 淺談laravel-admin form中的數(shù)據(jù),在提交后,保存前,獲取并進(jìn)行編輯

    淺談laravel-admin form中的數(shù)據(jù),在提交后,保存前,獲取并進(jìn)行編輯

    今天小編就為大家分享一篇淺談laravel-admin form中的數(shù)據(jù),在提交后,保存前,獲取并進(jìn)行編輯,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2019-10-10
  • 再談PHP中單雙引號(hào)的區(qū)別詳解

    再談PHP中單雙引號(hào)的區(qū)別詳解

    單引號(hào)和雙引號(hào)到底有啥區(qū)別呢?很多朋友都不太清楚,下面通過(guò)本文給大家介紹PHP中單雙引號(hào)的區(qū)別詳解,感興趣的朋友一起學(xué)習(xí)吧
    2016-06-06
  • ThinkPHP訪問(wèn)不存在的模塊跳轉(zhuǎn)到404頁(yè)面的方法

    ThinkPHP訪問(wèn)不存在的模塊跳轉(zhuǎn)到404頁(yè)面的方法

    這篇文章主要介紹了ThinkPHP訪問(wèn)不存在的模塊跳轉(zhuǎn)到404頁(yè)面的方法,需要的朋友可以參考下
    2014-06-06
  • php a simple smtp class

    php a simple smtp class

    php a simple smtp class...
    2007-11-11
  • php實(shí)現(xiàn)只保留mysql中最新1000條記錄

    php實(shí)現(xiàn)只保留mysql中最新1000條記錄

    這篇文章主要介紹了php實(shí)現(xiàn)只保留mysql中最新1000條記錄的方法和相關(guān)示例及數(shù)據(jù)庫(kù)結(jié)構(gòu),十分的全面,有需要的小伙伴可以參考下。
    2015-06-06
  • 詳解PHP素材圖片上傳、下載功能

    詳解PHP素材圖片上傳、下載功能

    這篇文章主要介紹了PHP圖片上傳下載功能,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-04-04
  • 分享個(gè)簡(jiǎn)單易懂且非常有用的laravel事件

    分享個(gè)簡(jiǎn)單易懂且非常有用的laravel事件

    這篇文章主要給大家介紹了一個(gè)簡(jiǎn)單易懂并且非常有用的laravel事件,文中通過(guò)實(shí)例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面跟著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-08-08

最新評(píng)論

晋江市| 安丘市| 黑龙江省| 彰化县| 阜康市| 三原县| 扎囊县| 年辖:市辖区| 深州市| 泸定县| 津南区| 芜湖县| 治县。| 延庆县| 伊春市| 上杭县| 成武县| 维西| 寿宁县| 铜鼓县| 定南县| 太康县| 陆良县| 乌苏市| 海兴县| 陈巴尔虎旗| 建水县| 静宁县| 扎兰屯市| 南开区| 麻江县| 兴义市| 临沂市| 吉首市| 桐乡市| 竹北市| 嘉黎县| 松阳县| 嘉定区| 刚察县| 碌曲县|