I need to make role menu in laravel , i have make in User model this funcion
public function isTeacher() {
return $this->where('role', '3')->exists();
}
and at the app.blade making this :
@if(Auth::user()->isTeacher())
<li class=" btn">
<a class="menu" href="/">الرئيسية</a>
</li>
<li class=" btn">
<a class="menu" href="/">تقييم الأطفال</a>
</li>
<li class=" btn">
<a class="menu" href="/">تسجيل طفل جديد</a>
</li>
<li class=" btn">
<a class="menu" href="/indexTable">إدخال جدول الانشطة</a>
</li>
<li class=" btn">
<a class="menu" href="/">مراجعة جدول الانشطة</a>
</li>
@endif
@if (Auth::guest())
<li class=" btn">
<a href="/register" class="log"> تسجيل ولي أمر جديد </a>
</li>
@endif
But it's giving me that error :
Call to a member function isTeacher() on a non-object
via Dina Shaldoum