Я новичок в Laravel, я использую tinker для создания записи:
$Profile=new \App\Profile();
=> App\Profile {#3038}
>>> $profile->title='Premier Titre'
PHP Warning: Creating default object from empty value in Psy Shell code on line 1
>>> $profile->title='Premier Titre';
=> "Premier Titre"
>>> $profile->description='Description';
=> "Description"
>>> $profile->user_id=1;
=> 1
>>> $profile->save()
PH
У меня есть следующая ошибка: Ошибка PHP: вызов неопределенного метода stdClass::save() в коде Psy Shell в строке 1
Здесь мой профиль.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Profile extends Model
{
public function user()
{
return $this->belongsTo(User::class );
}
}
вот мой код миграции:
public function up()
{
Schema::create('users', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('name');
$table->string('surname')->unique();
$table->string('email')->unique();
$table->timestamp('email_verified_at')->nullable();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
заранее спасибо