Reputation: 231
I am developing two API's login and registration by using APIATO-framework , i am writing return response also but i am getting all meta information along with the assigned message , but i don't want to print like that i want only assigned response only ,How to achieve this thing please help me to fix this issue...
This is what I'm getting:
UserController.php
<?php
namespace App\Containers\UserRegistration\UserContainer\UI\API\Controllers;
use App\Ship\Parents\Controllers\ApiController;
use App\Containers\UserRegistration\UserContainer\Models\UserContainer;
use Illuminate\Http\Request;
use Validator;
use JWTAuth;
class UserController extends ApiController
{
public function register(Request $request)
{
$user = new UserContainer([
'fullName'=> $request->input('fullName'),
'email'=> $request->input('email'),
'password'=> bcrypt($request->input('password')),
'mobile'=> $request->input('mobile'),
]);
$user->save();
// This response only i want to display
return response()->json(['message'=>'user registered successfully']);
}
}
UserRoute.v1.public.php
<?php
/**
* @apiGroup UserContainer
* @apiName UserController
*
* @api {POST} /v1/postuser Endpoint title here..
* @apiDescription Endpoint description here..
*
* @apiVersion 1.0.0
* @apiPermission none
*
* @apiParam {String} parameters here..
*
* @apiSuccessExample {json} Success-Response:
* HTTP/1.1 200 OK
{
// Insert the response of the request here...
}
*/
use App\Containers\UserRegistration\UserContainer\UI\API\Controllers\Controller;
use Illuminate\Support\Facades\Route;
use App\Containers\UserRegistration\UserContainer\UI\API\Controllers\UserController;
Route::post('userregister', [UserController::class, 'register']);
Route::post('login', [UserController::class, 'login']);
Upvotes: 0
Views: 100
Reputation: 14271
I don't use Apiato, but it seems that the value is added only with debug mode active (similar to Laravel Debugbar). Here's the Middleware part that does it:
if ($response instanceof JsonResponse && app()->bound('debugbar')) {
$profilerData = ['_profiler' => app('debugbar')->getData()];
$response->setData($response->getData(true) + $profilerData);
}
Now, from the Apiato docs it states that it should be disabled by default. Maybe you turned it on somehow. To disable it go to your .env
and:
DEBUGBAR_ENABLED=false
Upvotes: 1