2017-03-20 9 views
1

コントローラーでIDを選択し、次のものを選択するために+1を追加しようとしましたが、nullオブジェクトが返されます。誰かが+1 IDを選択する方法を知っていますか?結果は空にすることができますので、おかげで事前コントローラーの状態は次のIDを選択します

でたくさんここに私のコントローラ

//condition if checkbox is selected ! 

     if($licencie_amateur->surclasser === true){ 


      $licencie_amateur->lb_surclassement = ActiviteLicencie::where('catg_licence_id' , '=' , $categorie_age->id+1)->first(); 

     }elseif ($licencie_amateur->surclasser === false){ 

      // do nothing 

     } 

答えて

1

はあなたの解決策は機能しません。だから、これを代わりに:

ActiviteLicencie::where('catg_licence_id', '>', $categorie_age->id) 
    ->orderBy('catg_licence_id') 
    ->first(); 
+1

ありがとう!それは今働いている!!!!!!!! –

関連する問題