How to use auth(for loggedin user id) and antl(Internationalization) in validator class

I have created validator class now i want to use auth(for loggedin user id), and antl (for validation message). Can anyone help me.

Yes i have option to use it in controller but i want to keep my code saparate

'use strict'

class LoginUser {
  get rules () {
    return {
      'username': 'required',
      'password': 'required'

  get messages () {
  	return {
  		"username.required": "Username field is required",
  		"password.required": "Password field is required" 

module.exports = LoginUser

@virk Sir, is there anything to do that ?

Hey @rajatinfograins! :wave:

You can handle authorization/authentication via the authorize method of your Validator class.

Concerning the I18n of your messages, please take a look at

1 Like