I am trying to get a record from my database using the Eloquents search method, however it unexpectedly returns null. If I run the query manually in the database, it returns the expected record.
I use the following in Laravel:
$support = Support::find(02155);
And the following are directly in the database:
SELECT * FROM support WHERE id = 02155;
The primary key column has the name 'id' of type smallint (5), unsigned and zerofill along with the auto increment set. I based the above βmanualβ query in the Laravel documentation according to what Laravel should do.
There are no error messages (what I see), and if I changed the Eloquent method to βall,β then all records will be returned correctly.
php mysql eloquent laravel
Jake stubbs
source share