search

Home  >  Q&A  >  body text

When the primary key of the data table is renamed, such as uid, the multi-table query in laravel's ORM cannot be executed.

1. For example, User::find(1)->hasOneMachine; will report an error because the primary key of the User table is uid instead of id

曾经蜡笔没有小新曾经蜡笔没有小新2839 days ago500

reply all(1)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-16 16:53:39

    User.php

    protected $primaryKey = 'uid';

    reply
    0
  • Cancelreply