vendredi 8 avril 2016

Laravel 5.1 Query Builder where AND where

Hello could you help me with laravel 5.1 query builder.

I want to create a query that has where AND where.

I have already read the whole documentation but i could get any answer.

This is my query:

 DB::table('connected_users')
        ->where('user_id',$user->id)
        ->where('connected_id',$id)
        ->update(['status' => '2']);

This is my route Code:

Route::post('teacher/{id}/connection/approve','ConnectController@aproveConnection');

This is my Laravel Controller Code:

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();
}

This is my POST form:

<form method="POST" action="../teacher/{{ $pend_user->id }}/connection/approve">
   {!! csrf_field() !!}
   <input type="submit" value="Αποδοχή Φίλου">
</form>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire