phpvms/resources/stubs/modules/controller-api.stub
2018-03-19 20:50:40 -05:00

36 lines
802 B
Plaintext

<?php
namespace $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Api;
use App\Interfaces\Controller;
use Illuminate\Http\Request;
/**
* class SampleController
* @package $MODULE_NAMESPACE$\$STUDLY_NAME$\Http\Controllers\Api
*/
class SampleController extends RestController
{
/**
* Just send out a message
* @param Request $request
*/
public function index(Request $request)
{
return $this->message('Hello, world!');
}
/**
* @param Request $request
*/
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,
]);
}
}