code:
public function getUserFourElemByUid($uid)
{
print_r(self::getInstance());
$user = self::all();
if (empty($user)) {
return null;
}
return $user->toArray();
}
where the print_r function prints the result as follows:
User_DetailModel Object ( [connection] => licai_user [table] => user_detail_2 [primaryKey] => uid [incrementing] => [timestamps] => 1 [perPage:protected] => 15 [attributes:protected] => Array ( ) [original:protected] => Array ( ) [relations:protected] => Array ( ) [hidden:protected] => Array ( ) [visible:protected] => Array ( ) [appends:protected] => Array ( ) [fillable:protected] => Array ( ) [guarded:protected] => Array ( [0] => * ) [dates:protected] => Array ( ) [casts:protected] => Array ( ) [touches:protected] => Array ( ) [observables:protected] => Array ( ) [with:protected] => Array ( ) [morphClass:protected] => [exists] => )
The value of the table field is user_detail_2, which is the table I want to query, but the following statement reports the following error:
Fatal error: Uncaught exception "PDOException" with message "SQLSTATE[42S02]: Base table or view not found: 1146 Table "licai_user.lc_user__detail_models" doesn"t exist" in /data0/userdata/****/htdocs/finance_licai/vendor/illuminate/database/Connection.php:292 Stack trace: -sharp0 /data0/userdata/****/htdocs/finance_licai/vendor/illuminate/database/Connection.php(292): PDO->prepare("select * from `...") -sharp1 /data0/userdata/****/htdocs/finance_licai/vendor/illuminate/database/Connection.php(616): Illuminate\Database\Connection->Illuminate\Database\{closure}(Object(Illuminate\Database\MySqlConnection), "select * from `...", Array) -sharp2 /data0/userdata/****/htdocs/finance_licai/vendor/illuminate/database/Connection.php(580): Illuminate\Database\Connection->runQueryCallback("select * from `...", Array, Object(Closure)) -sharp3 /data0/userdata/****/htdocs/finance_licai/vendor/illuminate/database/Connection.php(297): Illuminate\Database\Connection->run("select * in /data0/userdata/****/htdocs/finance_licai/vendor/illuminate/database/Connection.php on line 624
Table mentioned in error: licai_user.lc_user__detail_models does not exist, on the one hand, there is no this table in the database, on the other hand, it is not this table that I want to query, but the user_detail_ 2 table. Which big god will solve the problem?