错误。 我的代码是:
[[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', 'درخواست معتبر نمیباشد.'); } }
。users
为id
,{{1} }。uid
,users
。last_name
,users
。first_name
为permit
,id
。pid
,permit
。user_id
,permit
。name
,permit
。sadere
,permit
。shenasname
,{{ 1}}。permit
,birth_date
。permit
,degree1
。permit
,field1
。permit
,{{1} }。university
,permit
。province
,permit
。eng_reg_num
,permit
。melli
,permit
。mobile
,permit
。phone
,permit
。postal_code
,permit
。address
,permit
。{{ 1}}来自state
上的permit
内部加入created_at
。permit
=updated_at
。permit
其中users
。{{1 } = 1和permit
= 12限制1)