creating default object from empty value laravel

Posted by Paidboom - 8 months ago

creating default object from empty value laravel: This is post where the main purpose to write the post itself is to discuss further on how to handle the error stated as in the title of this post.

Creating default object from empty value

Solution 1

$output = new \stdClass();
$output->success = false;

OR

if (!isset($output)) 
    $output = new stdClass();
$output->success = false;

Solution

   $product = new product();