Only retrieve validated data from $request->validate()

Posted 4 months ago by Cruorzy

So sometimes I call my validation after a few checks, so i have a FormRequest with the rules and made a static function in there that return the rules.

But when I do

$data = $request->validate(CostCreate::getRules());
return $data;

I get more data than expected, I expect only the validate data but instead I get ALL the columns.

Any idea how I get only the validated data?

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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.