Support the ongoing development of Laravel.io →
Requests Forms Validation
Last updated 2 years ago.
0
Solution

You can set a public variable on the Request instance, something like this:

public function authorize()
{
    $post = Post::where('id', $this->id)->where('user_id', Auth::id())->get()
    if($post->count()>0){
        $this->post = $post;
        return true;
    }
    return false;
}

and then in controller action, for instance:

public function someAction(FormRequestChild $request)
{
      var_dump($request->post);
}

Hope this helps!

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Rockroxx rockroxx Joined 13 Feb 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.