dimanche 29 mai 2016

JSON endpoints alongside regular actions in controllers

I have a QuizzesController which implements all of the standard restful actions: create, store, edit, etc. And I also have additional presentQuestion and answerQuestion:

public function presentQuestion 
{
    // . . .
    return response()->json($question);
}

public function answerQuestion($quiz_id)
{
    // . . .        
    $this->handleAnsweredQuestion($question_id);
}

Is it a good practice to mix the JSON endpoints with regular php actions in controllers, or can this design cause any unexpected problems in the future?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1TOg6bw
via IFTTT

Aucun commentaire:

Enregistrer un commentaire