• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

Laravel 5 controller sending JSON integer as string

phpjsonlaravellaravel-5php-5.6


PHP Snippet 1:

return response()->json(["foo" => "bar"], 200, [], JSON_NUMERIC_CHECK);

PHP Snippet 2:

return (int)Post::find(1)->id;

PHP Snippet 3:

class Controller extends BaseController {
    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

    public static function json($json) {
        return response()->json($json, 200, [], JSON_NUMERIC_CHECK);
    }

PHP Snippet 4:

return self::json($all);

Related Snippets

Guzzle Not Sending Grant Type to Laravel Passport

How to create laravel storage symbolic link for production or sub domain system?

Add bold text and line break into Laravel Notification Email

How to send parameters in soap request in php in __soapcall() function

How can I get data from PHP to Android TextView?

Trying to iterate over a mongodb cursor twice - failing

Laravel: HTML in notification

Ajax GET request fails in laravel 8

Transfer data between JavaScript and PHP through JSON

how can I set a session variable in Drupal 8 and get it in a php script?

PHP Discord OAUTH2 code sample not working

Saving Data from form to database using AngularJS and php

Transpose multidimensional array and join values with commas

PHP block shortcut in Visual Studio Code

how to identify the web server name of remote host

About Contact Privacy policy Terms and conditions