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.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community