Я получаю эту ошибку, когда пытаюсь запустить приложение в браузере.Он отлично работает с Laravel 5.3 , но не с 5.5 :
ErrorException Неопределенная переменная: invitationsN (Представление: C: \ xampp \ htdocs \ netPol \ resources\ views \ layouts \ complainant.blade.php) (представление: C: \ xampp \ htdocs \ netPol \ resources \ views \ layts \ complainant.blade.php
представление
<i class="entypo-list"></i> <span
class="badge badge-warning">{{sizeof($invitationsN)}}</span> </a>
<ul class="dropdown-menu">
<!-- TS14950193223600: Xenon - Boostrap Admin Template created by Laborator / Please buy this theme and support the updates -->
<li class="top"><p>You have {{sizeof($invitationsN)}} invitation(s)</p></li>
<li>
<ul class="dropdown-menu-list scroller">
@forelse($invitationsN as $invitation)
<li class="unread notification-success">
<a href="{{url('report/'.$invitation->report->code."/?invitation=1")}}">
<i class="entypo-eye pull-right"></i>
<span class="line">
<strong><b>From: </b>{{$invitation->invitor->name}}</strong>
</span>
<span class="line small">
{{\Carbon\Carbon::parse($invitation->created_at)->diffForHumans()}}
</span>
</a>
</li>
@empty
@endforelse
</ul>
</li>
Код
use Net_Police\User;
use Illuminate\Support\Facades\Auth;
use Illuminate\View\View;
class NotificationComposer
{
public $user;
public function __construct()
{
// $this->user = $user;
}
public function compose(View $view)
{
if(Auth::guest()){
$invitationsN = [];
}else{
$invitationsN = Auth::user()->receivedInvitations;
}
$view->with([ 'invitationsN' => $invitationsN ]);
}
}