JellyBool ,我用的是5.3版本的,看的是你这个系列的视频:稍微深入Laravel 5 >> 本地化Model Factory
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Faker\Generator as FakerGenerator;
use Faker\Factory as FakerFactory;
class AppServiceProvider extends ServiceProvider
{
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//生成数据本地化
$this->app->singleton(FakerGenerator::class, function() {
return FakerFactory::create('zh_CN');
});
}
/**
* Register any application services.
*
* @return void
*/
public function register()
{
}
}