KoolReport's Forum

Official Support Area, Q&As, Discussions, Suggestions and Bug reports.
Forum's Guidelines

Are you sure this code is correct? #1879

Closed Eugene opened this topic on on Jan 29, 2021 - 2 comments

Eugene commented on Jan 29, 2021

It is from your dashboard example

protected function login(
    {
        return Login::create()->
                ->headerText("Login")
                ->descriptionText("Sign in to your account")
                ->buttonText("Login")
                ->failedText("Wrong username or password")
                ->rightImageUrl("/assets/login/image.jpg");
                ->authenticate(function($uername,$password){
                    //You can make database connection in here to authenticate $username or password
                    //Return User class when it is authenticated

                    if($username==="johndoe" && $password==="johndoe") {
                        return User::create()
                                ->name("John Doe")
                                ->id(1)
                                ->roles(["guest"]);
                    }
                    return null;
                })
    }
Eugene commented on Jan 29, 2021

Must be

protected function login()
    {
        return Login::create()
            ->headerText("Login")
            ->descriptionText("Sign in to your account")
            ->buttonText("Login")
            ->failedText("Wrong username or password")
            ->rightImageUrl("/assets/login/image.jpg")
        ->authenticate(function($username,$password){
        //You can make database connection in here to authenticate $username or password
        //Return User class when it is authenticated

        if($username==="johndoe" && $password==="johndoe") {
            return User::create()
                ->name("John Doe")
                ->id(1)
                ->roles(["guest"]);
        }
        return null;
    });
    }
KoolReport commented on Jan 30, 2021

You are right, thank you very much. The example has been fixed :)

Build Your Excellent Data Report

Let KoolReport help you to make great reports. It's free & open-source released under MIT license.

Download KoolReport View demo
help needed

None