My aim is to adapt the following controller methods to follow the DRY principle by moving the validation to form requests. However, I have a problem which is that there are overlaps between validation for different methods. For example, let's say that the input form has only one field and that's name, and that it's related to a Task model. Let's consider 3 controller methods now:
- storemethod: validate that- nameisn't empty
- updatemethod: validate that- nameisn't empty and that a- Taskwith the given- $idexists
- destroymethod: validate that a- Taskwith the given- $idexists
So for the store method I am checking the first assumption, for the destroy method I am checking the second assumption, and for the update method I am checking both.
So, ideally, I would like to be able to do something like...
public function store(StoreTask $request)...
public function update(Store Task TaskExists $request, $id)...
public function destroy(TaskExists $id)...
...but I am very unclear on how to write the syntax for this, and whether there is some other approach which I'm missing to accomplish the same thing.
 
    