• 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

Toggle between a textbox and a select using PHP

Reorder attribute dropdown terms in Woocommerce single variable products

Minimum order amount except for specific shipping method in WooCommerce

How to get page number on dompdf PDF when using "view"

Cannot retrieve error message using Symfony HttpClient if the response is not "ok"

Docker image build with PHP zip extension shows "bundled libzip is deprecated" warning

Pass an image through AJAX [duplicate]

Performance of foreach, array_map with lambda and array_map with static function

How to update array value in Laravel

Is it possible to change the table name in the migration file-laravel

Remove categories with all childs derived from parent category

Hide email address with stars (*)

how to get value from array in laravel

Laravel: Why is my variable not being set while it's in the construct function of the controller?

Wordpress wpdb->delete issue

About Contact Privacy policy Terms and conditions