当前位置: 首页>>代码示例>>PHP>>正文


PHP Member::Create方法代码示例

本文整理汇总了PHP中app\Member::Create方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::Create方法的具体用法?PHP Member::Create怎么用?PHP Member::Create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\Member的用法示例。


在下文中一共展示了Member::Create方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

	/**
	 * Run the database seeds.
	 *
	 * @return void
	 */
	public function run()
	{
		Model::unguard();

		// $this->call('UserTableSeeder');
		//Member::Create(['username' => 'louis', 'password'=>'pw','secretquestion'=>'Where is your birth place?','secretanswer'=>'Hong Kong']);
		Member::Create(['username' => 'admin', 
						'password'=>'admin',
						'secretquestion'=>'Where is your birth place?',
						'secretanswer'=>'Hong Kong']);
		/*Category::Create ([
			'name'	=> 'Nature'
		]);
		Category::Create ([
			'name'	=> 'Architecture'
		]);
		Category::Create ([
			'name'	=> 'People'
		]);
		Category::Create ([
			'name'	=> 'Tech'
		]);
		Category::Create ([
			'name'	=> 'Animals'
		]);

    	$faker = Faker::create();
    	for ($i=0; $i<100; $i++){
    		$title 		= '';
    		$detail		= $faker->realText(450,2);
    		$hadstock 	= true;
    		$slug		= $title;
    		$publisher	= $faker->name();
    		$company 	= $faker->company();
    		$price 		= 0.0 + Rand(1,60000) / 100;
    		$cid 		= 0;
    		$imgsrc	 	= 'http://placeimg.com/268/249/'.'nature'.'/'.Rand(1,100);
    		switch (Rand(0,4)){
    			case 0:
	    			$cid 		= 1;
	    			$imgsrc	 	= 'http://placeimg.com/268/249/'.'nature'.'/'.Rand(1,100);
					break;
				case 1:
	    			$cid 		= 2;
	    			$imgsrc	 	= 'http://placeimg.com/268/249/'.'arch'.'/'.Rand(1,100);
					break;
				case 2:
	    			$cid 		= 3;
	    			$imgsrc	 	= 'http://placeimg.com/268/249/'.'people'.'/'.Rand(1,100);
					break;
				case 3:
	    			$cid 		= 4;
	    			$imgsrc	 	= 'http://placeimg.com/268/249/'.'tech'.'/'.Rand(1,100);
					break;
				case 4:
	    			$cid 		= 5;
	    			$imgsrc	 	= 'http://placeimg.com/268/249/'.'animals'.'/'.Rand(1,100);
					break;
			}
			$maxTitle = Rand(1,5);
			for ($j=0;$j < $maxTitle; $j++){
				$temp = '';
				switch (Rand(0,6)){
					case 0:
					$temp = $faker->cityPrefix();
					break;
					case 1:
					$temp = $faker->streetSuffix();
					break;
					case 2:
					$temp = $faker->citySuffix();
					break;
					case 3:
					$temp = $faker->word();
					break;
					case 4:
					$temp = $faker->century();
					break;
					case 5:
					$temp = $faker->lastName();
					break;
					case 6:
					$temp = $faker->stateAbbr();
					break;
				}
				$title .=' '. $temp;
			}
    		$newProduct = Product::Create ([
    			'cid'		=> $cid,
    			'title' 	=> ucwords($title),
    			'imgsrc'	=> $imgsrc,
    			'detail'	=> $detail,
    			'hadstock'	=> $hadstock,
    			'publisher'	=> ucwords($publisher),
    			'company'	=> ucwords($company),
//.........这里部分代码省略.........
开发者ID:simplylouis,项目名称:online_book_shop_20151110_laravel_5,代码行数:101,代码来源:DatabaseSeeder.php


注:本文中的app\Member::Create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。