Laravel加入错误“SQLSTATE [23000]:完整性约束违规”

时间:2018-04-15 08:22:32

标签: php laravel

在laravel中连接表时出现

错误。 我的代码是:

[[152.12238]]

并收到错误:

  

QueryException:SQLSTATE [23000]:完整性约束违规:1052 where子句中的列'id'不明确(SQL:选择public function show($id) { try { $idd = Sentry::getUser()->id; $permit = Permit::join('users', 'permit.user_id', '=', 'users.id') ->where('permit.user_id', (int)$idd) ->select('users.id as uid','users.last_name','users.first_name','permit.id as pid', 'permit.user_id', 'permit.name', 'permit.sadere', 'permit.shenasname', 'permit.birth_date', 'permit.degree1', 'permit.field1' , 'permit.university', 'permit.province', 'permit.eng_reg_num', 'permit.melli', 'permit.mobile', 'permit.phone', 'permit.postal_code' , 'permit.address', 'permit.state', 'permit.created_at', 'permit.updated_at') ->find($id); echo $permit->last_name; //$permit = Permit::find($id); $list = Permit::paginate(10); $cites = DB::table('provinces')->get(); $evidence = Evidence::find($id); return View::make('manager.admin_permit.show', compact('list', 'cites', 'evidence')) ->with('permit', $permit); } catch (ModelNotFoundException $e) { return Redirect::route('dashboard.admin.permit.index')->with('danger', 'درخواست معتبر نمیباشد.'); } } usersid,{{1} }。uiduserslast_nameusersfirst_namepermitidpidpermituser_idpermitnamepermitsaderepermitshenasname,{{ 1}}。permitbirth_datepermitdegree1permitfield1permit,{{1} }。universitypermitprovincepermiteng_reg_numpermitmellipermitmobilepermitphonepermitpostal_codepermitaddresspermit。{{ 1}}来自state上的permit内部加入created_atpermit = updated_atpermit其中users。{{1 } = 1和permit = 12限制1)

0 个答案:

没有答案