77fe6679ce
* Update module generation #714 * Fix method signatures * Fix paths within stubs, use single provider.stub file * Add separate index controller * Update module generation #714 * Fix method signatures * Fix paths within stubs, use single provider.stub file * Update module generation Disable/lower the cache time as found as a workaround in https://github.com/nWidart/laravel-modules/issues/995 * Update editorconfig for line endings * Formatting * Formatting
43 lines
883 B
Plaintext
43 lines
883 B
Plaintext
<?php
|
|
|
|
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Api;
|
|
|
|
use App\Contracts\Controller;
|
|
use Illuminate\Http\Request;
|
|
|
|
/**
|
|
* class ApiController
|
|
* @package $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Api
|
|
*/
|
|
class ApiController extends Controller
|
|
{
|
|
/**
|
|
* Just send out a message
|
|
*
|
|
* @param Request $request
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function index(Request $request)
|
|
{
|
|
return $this->message('Hello, world!');
|
|
}
|
|
|
|
/**
|
|
* Handles /hello
|
|
*
|
|
* @param Request $request
|
|
*
|
|
* @return mixed
|
|
*/
|
|
public function hello(Request $request)
|
|
{
|
|
// Another way to return JSON, this for a custom response
|
|
// It's recommended to use Resources for responses from the database
|
|
return response()->json([
|
|
'name' => Auth::user()->name,
|
|
]);
|
|
}
|
|
|
|
}
|