Skip to content

getSharedInstance doesn't work on costum services #294

Closed
@mithazhe

Description

@mithazhe

I have custom service:

public static function loggedinuser($getShared = true)
{
if ($getShared)
{
return self::getSharedInstance('loggedinuser');
}
return (new UsersModel())->getUserById(session('user_id'));
}

if I call it with $getShared = true, It doesn't work, show NULL with var_dump, if $getShared = false, It works, show the data.

However. I make sure that getSharedInstance doesn't work on custom services, by moving that function into \system\Config\Services.php. The result, that function works well with $getShared = true.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions