Answer the question
In order to leave comments, you need to log in
Trying to get property 'id' of non-object. How to fix?
When creating a bundle, a ui is created, but does not return an id value.
model test:
class test extends Model
{
use HasFactory;
protected $guarded = [];
public function ui_name() {
return $this->belongsTo('App\Models\Uis', 'name_id', 'id');
}
public function ui_desc() {
return $this->belongsTo('App\Models\Uis', 'desc_id', 'id');
}
}
class Uis extends Model
{
use HasFactory;
protected $guarded = [];
public function category() {
return $this->hasOne('App\Models\Categories\Category', 'ui_id', 'id');
}
public function tag() {
return $this->hasOne('App\Models\Tags\Tag', 'ui_id', 'id');
}
public function test_name() {
return $this->hasOne('App\Models\Tests\test', 'name_id', 'id');
}
public function test_desc() {
return $this->hasOne('App\Models\Tests\test', 'desc_id', 'id');
}
}
$test = new test();
$test->ui_name()->create([
'text' => "TEXT",
'desc'=> "TEXT",
'module_id' =>1,
'isHTML' => false
]);
Schema::create('tests', function (Blueprint $table) {
$table->id();
$table->bigInteger('name_id');
$table->bigInteger('desc_id')->nullable();
$table->integer('max_ball')->default(20);
$table->string('password')->nullable();
$table->string('special_link')->unique()->nullable();
$table->timestamps();
});
$table->id();
$table->string('text');
$table->text('desc');
$table->bigInteger('module_id')->nullable();
$table->boolean('isHTML')->default(false);
$table->timestamps();
ErrorException
Trying to get property 'id' of non-object
Answer the question
In order to leave comments, you need to log in
:first-child will just look for the first element in the block and not the first among .active
if the first element is not .active then the .active:first-child selector will not work
reset can be done via :not(.active) for example
$test = new test();
You created an object but didn't save it to the database. And since you didn’t do this, you don’t have the id property either.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question