Skip to content

4. Features

kurosawa93 edited this page Dec 19, 2018 · 3 revisions

Validation

This feature is regarding user validation. In ramenauth, we are using two kind of rules. First is rules which is defined inside ramenauth config file, located at config/ramenauth.php. If you are not defined the rules in configuration file, you can defined the rules inside the model class itself.The rules is covering all of model class attributes validation, like username, password, email, phone, etc. You can also define which method will access which rules. The rules is a JSON Object, and example of rules are following:

    protected $rules = [
            "store" => [
                "first_name" => "required",
                "phone" => "required_without:email|unique:users|min:7",
                "username" => "unique:users|min:5",
                "email" => "required_without:phone|unique:users|email",
                "password" => "sometimes|confirmed|min:4",
            ],
            "update" => [],
        ];

store is the key which will be used to call the rules from methods. and then it contains of JSON Object which defines the attributes and their individual rules.

Verification

There is two type of verification in ramenauth, phone and email verification. You can choose one to set as primary verification, and that automatically made the other one as secondary verification. To set primary verification in your app, you need to define it inside of config/ramenauth.php. You can add primary_verification => 'email' to set email as primary verification method.

Token Generation

You can also use ramenauth to generate user token associate to your apps. ramenauth using JWT as type of token.

Clone this wiki locally