Does not recognize Requests in Laravel 5.5 project [closed]

1

I have the following methods in a controller:

public function edit2($id)
{
    $post       = Post::find($id);
    $this->authorize('pass', $post);

    $categories = Category::orderBy('name', 'ASC')->pluck('name', 'id');
    $tags       = Tag::orderBy('name', 'ASC')->get();

    return view('admin.posts.edit2', compact('post', 'categories', 'tags'));
}

public function update2(PostUpdateRequest2 $request, $id)
{
    $post = Post::find($id);
    $this->authorize('pass', $post);

    $post->user_id         = $post->user_id;
    $post->excerpt         = $post->excerpt;
    $post->body            = $post->body;

    $post->save(); 

    //IMAGE 
    if($request->file('file')){
        $path = Storage::disk('public')->put('image',  $request->file('file'));
        $post->fill(['file' => asset($path)])->save();
    }

    //NOTAS
    if($request->file('file2')){
        $path = Storage::disk('public')->put('notas',  $request->file('file2'));
        $post->fill(['file2' => asset($path)])->save();
    }

    //TAGS
    $post->tags()->sync($request->get('tags'));

    return redirect()->route('posts.edit', $post->id)->with('info', 'Entrada actualizada con éxito');
}

I have two update: update and update2 each with a request, PostUpdateRequest and PostUpdateRequest2 respectively. I can not find the reason why I do not recognize the PostUpdateRequest2, I get the following message

  

"Class App \ Http \ Controllers \ Admin \ PostUpdateRequest2 does not exist"

But when I change the request in Update2 by PostUpdateRequest, it does recognize it.

EDIT1: This would be the route of the request:

The request I want to use is the PostUpdateRequest2 in Update2 but I get the error message placed previously, however if I use the PostUpdateRequest in Update2 I do not get any error, but I do not want to use this request but the other one.

EDIT2: Dev. Joel is right, I just needed to care about the PostUpdateRequest2 request, so I could not find it.

    
asked by Kinafune 24.04.2018 в 03:01
source

0 answers