mercredi 29 novembre 2017

Wrong redirect when data have been submitted using if else laravel

I am trying to get a request from the input I just got where if the request input recommendation is No or KIV, it will redirect to home if not it will redirect to another page. But the problem now is that if the recommendation I put is Yes and some other things as No, it will redirect me to home instead of another page. Can someone help me out? Thanks a lot

    public function eval(Request $request){
     $Evaluation = new evaluation;
        $personal_info = new personal_info;
        $Evaluation->recommendation = $request->input('recommendation');
        $Evaluation->training_schedule = $request->input('training_schedule');
        $Evaluation->training_date = $request->input('training_date');
        $Evaluation->PortalLogin = $request->input('PortalLogin');
        $id = $request->user_id;
        $id= personal_info::find($id);
        $id->evaluations()->save($Evaluation);

        if(($Evaluation->recommendation = $request->input('recommendation')) == 'No' || 'KIV')
            return redirect('/home');
        else{
    return redirect(url('/user/showtest/'.$id->id.'/test) );
}

Aucun commentaire:

Enregistrer un commentaire