A
A
Artem00712018-09-14 00:50:22
Laravel
Artem0071, 2018-09-14 00:50:22

How to take model from validator?

Laravel has a very handy validator
. It has one of the functions 'modelId' => 'exists:models,id'
. So here's how I can then use this data .
Now it turns out that first there is a request to check for the existence of this data, and then again the same request to take this very model.
Is there any way to make this model return from the validator
Yes, I know that there is a search not for a model, but for records in a certain table and a certain column
. Can there be some way to return this tuple from the database table?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
JhaoDa, 2018-09-14
@Artem0071

Write your own validation rule that will operate on the model and put it somewhere in a container, for example, from where you can get it later.
Only this is all saving not even on matches, but on the atoms of matches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question