Total Images: 20 Undefined property: stdClass::$product_id (500 Internal Server Error)

Symfony Exception

ErrorException

HTTP 500 Internal Server Error

Undefined property: stdClass::$product_id

Exception

ErrorException

Show exception properties
ErrorException {#37
  #severity: E_WARNING
}
  1. require __DIR__.'/vendor/autoload.php';
  2. $app = require __DIR__.'/bootstrap/app.php';
  3. $images = app('db')->table('product_images')->orderBy('id', 'desc')->limit(10)->get();
  4. echo "Total Images: " . count(app('db')->table('product_images')->get()) . "\n";
  5. foreach($images as $img) {
  6. echo "ID: {$img->id}, ProdID: {$img->product_id}, Image: {$img->image}\n";
  7. }
  1. protected function registerErrorHandling()
  2. {
  3. error_reporting(-1);
  4. set_error_handler(function ($level, $message, $file = '', $line = 0) {
  5. $this->handleError($level, $message, $file, $line);
  6. });
  7. set_exception_handler(function ($e) {
  8. $this->handleException($e);
  9. });
Application->{closure:Laravel\Lumen\Concerns\RegistersExceptionHandlers::registerErrorHandling():46}(2, 'Undefined property: stdClass::$product_id', '/home/vzizxmil/public_html/banyal-connect-api/test_db4.php', 7) in /home/vzizxmil/public_html/banyal-connect-api/test_db4.php (line 7)
  1. require __DIR__.'/vendor/autoload.php';
  2. $app = require __DIR__.'/bootstrap/app.php';
  3. $images = app('db')->table('product_images')->orderBy('id', 'desc')->limit(10)->get();
  4. echo "Total Images: " . count(app('db')->table('product_images')->get()) . "\n";
  5. foreach($images as $img) {
  6. echo "ID: {$img->id}, ProdID: {$img->product_id}, Image: {$img->image}\n";
  7. }

Stack Trace

ErrorException
ErrorException:
Undefined property: stdClass::$product_id

  at /home/vzizxmil/public_html/banyal-connect-api/test_db4.php:7
  at Laravel\Lumen\Application->handleError(2, 'Undefined property: stdClass::$product_id', '/home/vzizxmil/public_html/banyal-connect-api/test_db4.php', 7)
     (/home/vzizxmil/public_html/banyal-connect-api/vendor/laravel/lumen-framework/src/Concerns/RegistersExceptionHandlers.php:47)
  at Laravel\Lumen\Application->{closure:Laravel\Lumen\Concerns\RegistersExceptionHandlers::registerErrorHandling():46}(2, 'Undefined property: stdClass::$product_id', '/home/vzizxmil/public_html/banyal-connect-api/test_db4.php', 7)
     (/home/vzizxmil/public_html/banyal-connect-api/test_db4.php:7)