Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Mahendran-Balaji/e676c5d5d81ff686906220962fe3a678 to your computer and use it in GitHub Desktop.
Save Mahendran-Balaji/e676c5d5d81ff686906220962fe3a678 to your computer and use it in GitHub Desktop.
Example for 'How to use laravel default response code ?'
/* Open Response.php File From vendor/Symfony/http-foundation/ */
1) Refer attached File of Response.php
class Response
{
public const HTTP_CONTINUE = 100;
public const HTTP_SWITCHING_PROTOCOLS = 101;
public const HTTP_PROCESSING = 102; // RFC2518
public const HTTP_EARLY_HINTS = 103; // RFC8297
public const HTTP_OK = 200;
public const HTTP_CREATED = 201;
public const HTTP_ACCEPTED = 202;
..........
}
2) Add Triat in the controller : use Illuminate\Http\Response;
3) Call Constant variable: Response::HTTP_NO_CONTENT / Response::HTTP_OK
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment