【发布时间】:2018-01-03 10:51:39
【问题描述】:
我从 udemy.com 学习 Laravel,但我遇到了 migrate:refresh 命令的问题。所以,当我尝试使用它时,我会看到信息
数组到字符串的转换 我尝试解决我的问题,所以我犯了新的错误,所以这是我的代码: 进入 UserTableSeeder
public function run()
{
App\User::create([
'name' => 'Kati',
'email' => 'hello@hello.pl',
'password' => bcrypt('password'),
'admin' => 1
]);
App\Profile::create([
'user_id' => $user->id,
'avatar' => 'link to avatar',
'about' => 'Interested description',
'youtube' => 'youtube.com',
'facebook' => 'facebook.com'
]);
}
进入迁移
public function up()
{
Schema::create('profiles', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id');
$table->text('about');
$table->string('youtube');
$table->string('facebook');
$table->timestamps();
});
}
和
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->boolean('admin')->default(0);
$table->rememberToken();
$table->timestamps();
});
}
我尝试从 github 克隆我的存储库并刷新,但我遇到了一些问题。
【问题讨论】:
-
检查
$user->id是有效值