• 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

woocommerce get_order_report_data to show order_item_id

Detect if PHP session exists

Component install error: JInstaller: :Install: File does not exist

Change the alert text on add to cart action without selected variation in Woocommerce

find in set in laravel ? example

Backend cannot be reached after Typo3 login screen

Display the WooCommerce product price inside a custom function

Detect a fetch request in PHP

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

find in set in laravel ? example

How to send upload image through email

Transpose and flatten two-dimensional indexed array where rows may not be of equal length

shell errors running php exec

PHPExcel export HTML table to xlsx

java URL working on browser but not in client program

About Contact Privacy policy Terms and conditions