There is a problem with calling Validation via a variable #233
-
That's how I wanted to use it: But how can you fix such an error? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Hello, I saw your message about this in the Scramble Discord. Scramble analyzes the code statically and is, therefore, unable to get the context of what happens during the runtime of your code. Evaluation of your variable includes that. It's not necessarily impossible to provide native support for what you intend to do, but I believe it would require significant work to accomplish it elegantly. Suppose this is a typical pattern throughout your code. In that case, I recommend using the Scramble Extension API to write an |
Beta Was this translation helpful? Give feedback.
-
Hey @SalawatJoldasbaev Can you try it like this? $request->validate(($data = app(ActivityStore::class))->rules()); The trick here is making sure to pass rules in a way so |
Beta Was this translation helpful? Give feedback.
Hey @SalawatJoldasbaev
Can you try it like this?
The trick here is making sure to pass rules in a way so
eval
will work for them: https://scramble.dedoc.co/usage/request#rules-evaluation-caveats