ApiResponder Traits for facility when build a laravel Restful Api
Use the File Traits in Base Controller Laravel
use App\Http\Traits\ApiResponder;
class Controller extends BaseController
{
use ApiResponder;
}
## Example
public function register(RegisterRequest $request)
{
$token = $request->store();
SendVerifyMail::dispatch($request->email, $token);
return $this->successStatus(__("Send Email"));
}
Function |
---|
successStatus |
errorStatus |
respondNoContent |
respondWithItem |
respondWithItemName |
respondWithCollection |
respondWithMessage |
respondCreated |
respondWithError |
errorForbidden |
errorInternalError |
errorNotFound |
errorUnauthorized |
errorWrongArgs |