mardi 31 janvier 2023

Trying to get property 'emp_access_level' of non object [closed]

At this line of code:

@if(Auth::user()->employee->emp_access_level == 1)
<a class="linker list-group-item list-group-item-action  border-right-0 "
   href="">
   <i class="fas fa-home"></i>
   <span>Firm Home</span>
</a>

enter image description here

I am writing code for 2 factor authentication but ran into this issue of trying to get property 'emp_access_level' of non-object.

I have defined the emp-access-level here:

Schema::create('employees', function (Blueprint $table) {
     $table->increments('id');
     $table->integer('emp_org_id')->unsigned()->nullable();
     $table->integer('emp_user_id')->unsigned()->unique()->nullable();
     $table->string('emp_notes')->nullable();
     $table->boolean('emp_status')->nullable();   //false: not allowed true:allowed
     $table->string('emp_leave_date')->nullable();
     $table->string('emp_access_level')->nullable();
     $table->foreign('emp_user_id')->references('id')->on('users');
     $table->foreign('emp_org_id')->references('id')->on('organizations');
     $table->timestamps();
});


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/LGyn3rx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire