VigoKrumins
1 year ago

Request validation from custom table.

Posted 1 year ago by VigoKrumins

Hi! Anyone can help?

  1. Created User model with protected $table = 'my_custom_table'.
  2. Custom Request (e.g. StoreUsersRequest) to validate the FormRequest.

Problem - How to pass from User model $table to StoreUsersRequest?

Of course, I can validate like: 'email' => 'required|unique:my_custom_table', but I'd like to make it like this - if I change $table in the model, it changes table name in the request automatically. Any solution?

Thanks, Vigo

Please sign in or create an account to participate in this conversation.