In Laravel or php when we use to create a generic empty class, especially in Laravel then we need to include the namespace of stdclass.
For example:
// create a new object.
$dataObj = new stdClass();
If we run the above code in Laravel then we will get the error message
Laravel Fatal error: Class 'StdClass' not found
Solution:
On the top of the page Include
use \stdClass
Also if we add a backslash something like below
$Obj = new \stdClass();
In either of the above cases, it will work without any issue.
Laravel framework blog that will include laravel fixes, laravel issues, and much more about Laravel framework.
Subscribe to:
Post Comments (Atom)
Laravel csrf token mismatch for ajax post request
Error "CSRF Token Mismatch" commonly occurs if tokens do not match in both sessions and sent , and received requests.CSRF token he...
-
The error message "cURL error 6: getaddrinfo() thread failed to start" in a PHP Laravel context typically indicates a problem with...
-
Errors: Auth guard driver [api] is not defined. Lumen 5.4 - Auth guard driver [api] is not defined. InvalidArgumentException: Auth guard [...
No comments:
Post a Comment