• 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

Is there a way to use the same parameter into multiple place in the same query with Eloquent? [duplicate]

Undefined Array Key error when uploading image on php

Laravel MSSQL Server Connection not working

How to read laravel_session cookies saved in cookie memory of browser in client side?

merge all files in directory to one text file

LARAVEL: How to fetch id dynamically in a query builder?

How in Laravel run JavaScript code stored in php variable?

Creating Combinations of Elements

image source not readable

How to override header set in Apache config with more specific header in a virtual host

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

The "client_reference_id" argument is not passed

Inserting Country Selection into MySQL PHP [duplicate]

PHPExcel export HTML table to xlsx

Multiply each value in array using array_map function

About Contact Privacy policy Terms and conditions