- <?php
-
- namespace App\Sessions;
-
- use App\Features\InstanceAble;
- use Illuminate\Support\Facades\Auth;
- use Illuminate\Validation\UnauthorizedException;
-
- class SessionUser
- {
- use InstanceAble;
-
- public function user()
- {
- $user = Auth::user();
- if ($user === null) {
- throw new UnauthorizedException();
- }
- return $user;
- }
- }
|