php - Fatal error - Cannot use object of type stdClass as array (Eloquent) -
error trying row database using eloquent:
fatal error: cannot use object of type stdclass array in...
i'm using wamp. make observation because i've implemented similar codes in remote servers , got no problems.
$row = $database::table('users')->where('email', $email)->first();
the issue when i'm trying take $row content:
if($row['first_name']) { // causes fatal error }
why?
next, database configuration file:
use illuminate\database\capsule\manager capsule; $database = new capsule(); $database->addconnection([ 'driver' => 'mysql', 'host' => 'localhost', 'database' => 'animalfm', 'username' => 'root', 'password' => '' ]); $database->setasglobal(); $database->booteloquent();
Comments
Post a Comment