infrastructure/Middleware/BuildApiResponse.php
/**
	 * - Handle an incoming request.
	 *
	 * - @param  \Illuminate\Http\Request $request
	 * - @param  \Closure $next
	 * - @param  string|null $guard
	 * - @return mixed
	 */
- Handle an incoming request.
- Handle an incoming request .
public function handle($request, Closure $next, $guard = null)
	{
		$response = $next($request);
		if($response instanceof JsonResponse) {
			$original = $response->getOriginalContent();
			if(!isset($original['success'])) {
				$response->setData([
					'success' => true,
					'data' => $original
				]);
			}
		}
		return $response;
	}
public function handle ( $ request , Closure $ next , $ guard = null ) { $ response = $ next ( $ request ) ; if ( $ response instanceof JsonResponse ) { $ original = $ response -> getOriginalContent ( ) ; if ( ! isset ( $ original [ 'success' ] ) ) { $ response -> setData ( [ 'success' => true , 'data' => $ original ] ) ; } } return $ response ; }
- Handle an incoming request.
- Handle an incoming request .