title: How to make a validation in 5.2?
body: <p>Please can any one give a idea about this type validation.</p>
  
  <pre><code> public function joinclass()
      {
        if($class_code = $request-&gt;get('class_code');
          $classroom = classroomModel::where('class_code',$class_code)-&gt;first();
         {
            $class = new joinclass();
          $class -&gt; user_id = Auth::user()-&gt;id;
          $class -&gt; class_code = $request['class_code'];
          $class -&gt; save();
         }else if{
           Flash::message('Your code is not found in databse');
          }elseif($classroom = joinclass::where('class_code',$class_code)-&gt;first();){
        Flash::message('You are already in this classroom');
  }
      }
  </code></pre>
  
  <p>What is the write formet for this code and this type condition.</p>