I am trying to do an update with my data but when I try to pass $object to another view it is returning me null value. I did a dd($id) and it return me the id that I wanted but if I do a dd($object) return me null. I have check similar question to this such as Laravel Eloquent::Find() returning NULL with an existing ID but still doesn't work. Everyone say that the problem comes from the database, but I don't understand which part. Can anyone help me? Thanks a lot
VerificationController:
public function editVerify($id){
$object = Verification::find($id);
dd($object);
return view('editVerify', compact('object'));
}
Verification Model:
public function personal_infos() {
return $this->belongsTo("App\PersonalInfo", "id", 'user_id');
}
PersonalInfo model:
public function verifications() {
return $this->hasOne('App\Verification','user_id');
}
This is what it look like in the database(some value are NULL while some contain data) Verification table:
Schema::create('verifications', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('Nationality');
$table->string('identity_type');
$table->string('residential_status');
$table->string('NRIC_check');
$table->string('nric_number1');
$table->string('blacklist');
$table->string('whiteCard');
$table->string('educational_cert');
$table->string('WSQ_cert');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('personal_infos');
$table->timestamps();
});