Laravel 5.1 哪里和哪里的查询生成器
Laravel 5.1 Query Builder where AND where
你好,你能帮我 laravel 5.1 查询生成器吗?
我想创建一个包含 where 和 where 的查询。
我已经阅读了整个文档,但我可以得到任何答案。
这是我的查询:
DB::table('connected_users')
->where('user_id',$user->id)
->where('connected_id',$id)
->update(['status' => '2']);
这是我的路线代码:
Route::post('teacher/{id}/connection/approve','ConnectController@aproveConnection');
这是我的 Laravel 控制器代码:
public function aproveConnection($id){
$user = Auth::user();
DB::table('connected_users')
->where('user_id',$user->id)
->where('connected_id',$id)
->update(['status' => '2']);
return Redirect::back();
}
这是我的 POST 表格:
<form method="POST" action="../teacher/{{ $pend_user->id }}/connection/approve">
{!! csrf_field() !!}
<input type="submit" value="Αποδοχή Φίλου">
</form>
使用多个 where()
相当于 AND 运算符。只有当 where()
子句都满足您的搜索条件时,查询才会通过。
你好,你能帮我 laravel 5.1 查询生成器吗?
我想创建一个包含 where 和 where 的查询。
我已经阅读了整个文档,但我可以得到任何答案。
这是我的查询:
DB::table('connected_users')
->where('user_id',$user->id)
->where('connected_id',$id)
->update(['status' => '2']);
这是我的路线代码:
Route::post('teacher/{id}/connection/approve','ConnectController@aproveConnection');
这是我的 Laravel 控制器代码:
public function aproveConnection($id){
$user = Auth::user();
DB::table('connected_users')
->where('user_id',$user->id)
->where('connected_id',$id)
->update(['status' => '2']);
return Redirect::back();
}
这是我的 POST 表格:
<form method="POST" action="../teacher/{{ $pend_user->id }}/connection/approve">
{!! csrf_field() !!}
<input type="submit" value="Αποδοχή Φίλου">
</form>
使用多个 where()
相当于 AND 运算符。只有当 where()
子句都满足您的搜索条件时,查询才会通过。