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

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

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

然后在命令行中運行:

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

這個地方的引號是英文的,csdn編輯器原因,復制出來之后是中文的,記得改成英文。

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

數(shù)據庫結果記錄:

其他可用的東東:

/**
 * @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ù)據的方法就是小編分享給大家的全部內容了,希望能給大家一個參考,也希望大家多多支持腳本之家。

相關文章

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

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

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

    PHP讓網站移動訪問更加友好方法

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

    PHPMailer發(fā)送郵件

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

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

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

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

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

    ThinkPHP訪問不存在的模塊跳轉到404頁面的方法

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

    php a simple smtp class

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

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

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

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

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

    分享個簡單易懂且非常有用的laravel事件

    這篇文章主要給大家介紹了一個簡單易懂并且非常有用的laravel事件,文中通過實例代碼介紹的非常詳細,對大家的學習或者工作具有一定的參考學習價值,需要的朋友們下面跟著小編來一起學習學習吧。
    2017-08-08

最新評論

定襄县| 武邑县| 芦溪县| 广饶县| 金堂县| 嫩江县| 昌宁县| 都兰县| 平舆县| 滨海县| 禹州市| 清涧县| 芒康县| 镇沅| 广昌县| 荥经县| 卢氏县| 油尖旺区| 温州市| 清苑县| 九龙县| 镇宁| 朔州市| 淄博市| 自贡市| 扎兰屯市| 克拉玛依市| 顺昌县| 常州市| 淳化县| 周宁县| 揭西县| 邻水| 马关县| 射阳县| 乌恰县| 巴中市| 亚东县| 武清区| 嘉义县| 敦化市|