数据库表是:prefix_adminUsers,我在 UserAdmin.php 中有一个模型,如下所示:
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class UserAdmin extends Model
{
protected $table = 'adminUsers';
public $timestamps = false;
}
当我尝试通过控制器访问它时,它会显示错误:
Illuminate \ Database \ Eloquent \ Builder Object([query:protected] => Illuminate \ Database \ Query \ Builder Object([connection] => Illuminate \ Database \ MySqlConnection对象([pdo:protected] => PDO 对象
我的控制器如下:
use App\Model\UserAdmin;
$userRecord = UserAdmin::where('id', '=', Auth::user()->id);
print_r($userRecord);