Skip to content

Commit ee0157d

Browse files
author
Jiaquan He
committed
Dynamically fetch user from Sentinel.
User info may not be populated in Controller constructors. We'll fetch it on demand to avoid non-object issues.
1 parent 8af75e9 commit ee0157d

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

app/Http/Controllers/Controller.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,13 @@ class Controller extends BaseController
2323

2424
public function __construct()
2525
{
26-
$this->user = Sentinel::getUser();
26+
}
27+
28+
public function __get($property)
29+
{
30+
if ($property == 'user') {
31+
return Sentinel::getUser();
32+
}
2733
}
2834

2935
public function arrange($data)

0 commit comments

Comments
 (0)