Conditions | 5 |
Paths | 5 |
Total Lines | 24 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public function index(Thread $thread) |
||
12 | { |
||
13 | $user = Auth::user(); |
||
14 | |||
15 | if (! isset($user)) { |
||
16 | return abort(404); |
||
17 | } |
||
18 | |||
19 | if (! $thread->users()->get()->contains($user)) { |
||
20 | return abort(404); |
||
21 | } |
||
22 | |||
23 | $contacts = User::all(); |
||
24 | $threads = null; |
||
25 | $activeThread = Thread::find($thread->id); |
||
|
|||
26 | |||
27 | if (isset($user)) { |
||
28 | if ($user->threads()->exists()) { |
||
29 | $threads = $user->threads()->with('messages')->get(); |
||
30 | } |
||
31 | } |
||
32 | |||
33 | return view('vendor.messenger.index', compact('threads', 'activeThread', 'contacts')); |
||
34 | } |
||
35 | |||
72 |
Since your code implements the magic getter
_get
, this function will be called for any read access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.If the property has read access only, you can use the @property-read annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.