/** * Get user ID * * @return int|null */ public static function getUserId() { if (\Auth::user() !== null) { return (int) \Auth::user()->id; } return null; }