Answer the question
In order to leave comments, you need to log in
API architecture on Laravel?
Hello. I'm making a small API for AJAX requests. The API route itself looks like this:
Route::group(array('prefix' => 'api'), function()
{
Route::any('/v{version}/{group}.{method}.{type?}', '[email protected]');
});
public function callMethod($version, $controller, $method, $responseType = 'json')
{
$api = new Api\Api();
return $api->callMethod($controller, $method, $responseType);
}
public function callMethod($version, $controller, $method, $responseType = 'json')
{
$directory = 'v' . $version;
$className = "Api\\$directory\\Api()";
$api = new $className();
return $api->callMethod($controller, $method, $responseType);;
}
Answer the question
In order to leave comments, you need to log in
Maybe there is another option?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question