• 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

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

phpjqueryajaxlaravellaravel-5


PHP Snippet 1:

//...
$product  = json_decode($request->product, true);
//...

PHP Snippet 2:

 public function dopayment(Request $request) {

            $input = $request->all();

            $product = json_decode($request->product);


            foreach ($product as $single) {
                # code...

                print_r($single->name);
            }

           print_r($product);
            exit;
        }

PHP Snippet 3:

if (is_array($product ) || is_object($product ))
{
    foreach($product as $arrayItems){
      // Perform x.
    }
}

Related Snippets

Ajax GET request fails in laravel 8

Cross-Origin Resource Sharing (CORS) witth Laravel and Vuejs

How do I Post to .txt document before form submits

How can i hide dt if dd got empty value

Facebook API, get page post link (PHP)

How to fix Call to undefined method AppModelsTableName::factory?

Add customer email and phone in "Order" column to admin orders list on Woocommerce

Laravel set default language not working

how to see if database exists with PDO [duplicate]

How to validate Envato Purchase Code in PHP

Fetch files from next cloud storage and display in Laravel website

XML to CSV with PHP converter [problem with images grabing]

Dropdown with current value from Mysql

Manage independently the decimal number of the price of each product [duplicate]

Can't call javascript alert alertify library from PHP

About Contact Privacy policy Terms and conditions