Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9187517
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T19:47:20+00:00 2026-06-17T19:47:20+00:00

I’ve ran into a problem with some queries in Laravel due to the fact

  • 0

I’ve ran into a problem with some queries in Laravel due to the fact that some methods in query.php have a hard coded id as a column. Hence, if you use some other name than id in your database, these functions will fail miserably.

In my case I have an existing MSSQL database were the identity column of the user table is UserId not id. In my case the problem arises after a user has logged in – the script barfs with:

SELECT TOP 1 [userid] FROM [User] WHERE [id] = ?

Fluent seems to call one of those problematics functions, find in query.php, when trying to retrieve user data. Has anyone addressed this problem and if so how did you deal with?

UPDATE:

I do use Fluent as Auth driver and the error is triggered when doing Auth::check() or Auth::guest(). The stack trace looks like this:

#0 C:\laravel\database\connection.php(183): Laravel\Database\Connection->execute('SELECT TOP 1 [u...', Array)
#1 C:\laravel\database\query.php(709): Laravel\Database\Connection->query('SELECT TOP 1 [u...', Array)
#2 C:\laravel\database\query.php(653): Laravel\Database\Query->get(Array)
#3 C:\laravel\database\query.php(624): Laravel\Database\Query->first(Array)
#4 C:\laravel\auth\drivers\fluent.php(21): Laravel\Database\Query->find('162')
#5 C:\laravel\auth\drivers\driver.php(79): Laravel\Auth\Drivers\Fluent->retrieve('162')
#6 C:\laravel\auth\drivers\driver.php(65): Laravel\Auth\Drivers\Driver->user()
#7 C:\laravel\auth\drivers\driver.php(55): Laravel\Auth\Drivers\Driver->check()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T19:47:21+00:00Added an answer on June 17, 2026 at 7:47 pm

    There are 2 solutions to your problem:

    1. Do not use Eloquent (I inferred from your question that that’s what you were using). Instead, use Fluent, e.g.

      $users = DB::table('users')->where('UserId', '=', 1)->first();
      

      Though this approach is restrictive and, well, prevents you from using Eloquent.

    2. Define your model like this:

      class User extends Eloquent {
          public static $key  = 'UserId';
          public static $table = 'users';
      }
      

      where $key is the name of your primary key and $table is the name of your table (useful if it isn’t the plural of the model name). This looks great I guess but unfortunately it may not be enough if you use relationships. Have a look at this workaround for more info.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

this is what i have right now Drawing an RSS feed into the php,
I have a French site that I want to parse, but am running into
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have just tried to save a simple *.rtf file with some websites and
I have a small JavaScript validation script that validates inputs based on Regex. I
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I have been unable to fix a problem with Java Unicode and encoding. The
I'm trying to create an if statement in PHP that prevents a single post

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.