protected function getUserId($user)
    {
        if (is_null($user))
        {
            $user = auth()->user();
        }

        if ($user instanceof Model)
        {
            $user = $user->getKey();
        }

        return $user;
    }
protected function getUserId($user)
    {
        if (is_null($user))
        {
            $user = auth()->user();
        }

        if ($user instanceof Model)
        {
            $user = $user->getKey();
        }

        return $user;
    }
protected function getUserId ( $ user ) { if ( is_null ( $ user ) ) { $ user = auth ( ) -> user ( ) ; } if ( $ user instanceof Model ) { $ user = $ user -> getKey ( ) ; } return $ user ; }
Determines current user

@param Model|int $user
@return Model
Determines current user