Support the ongoing development of Laravel.io →
Configuration Requests Architecture

Hi guys,

I'm developping an API and because I have (mostly) the same functionality I've created an abstract class to be extended on my controllers.

My abstract class looks like: http://laravel.io/bin/23Bzj

Where in the controller I would construct with a model and response (will probably move the response to ApiController constructor later).

class EventController extends ApiController
{

  public function __construct(Event $model, ResponseRepository $response)
  {
     $this->model = $model;
     $this->response = $response;
  }
}

But the question is: how will I be able to use the specific Request class in my ApiController to be used the in the methods for validation/what is the best practice.

I can use a normal Request class but then I won't have any validation before the methods.

When I'm in my EventController I will be able to use UpdateEventRequest and CreateEventRequest and so on.

Last updated 2 years ago.
0

Anybody?

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

guidsen guidsen Joined 24 Mar 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.

© 2025 Laravel.io - All rights reserved.