title: I m not able the record in data base on laravel platform
body: <p>I am not able to save the record in the database, can you please help me, where I m mistake when only Multiple choice questions and fill in the blank question type their, records saved in the database, then add 1-2 words question type, in this time, any data do not save in database please help me this</p>
  <p>this is controller code</p>
  <pre><code>public function store(Request $request) {
      //
      $rules = [
      'quiz_id' =&gt; 'required',
      'question_type_id' =&gt; 'required',
      'question' =&gt; 'required|string|max:255',
      'answer' =&gt; 'required',
      'question_img' =&gt; 'image',
      ];
      
      $validator = Validator::make($request-&gt;all(),$rules);
      if($validator-&gt;fails()){
          return back()-&gt;with('warning','please Fill manadatory fields');
      } else {
          $addquestion = Questions::AddClass($request);
          if($addquestion)
              return redirect('/teachers/dashboard/allquestions')-&gt;with('success','Question Created Successfully!');
      }
  }
  </code></pre>
  <p>This is model code</p>
  <pre><code>protected $primary = 'id';
  protected $table = 'questions';
  protected $fillable = ['quiz_id','question_type_id', 'question', 'a','b','c','d', 'answer',  
  'status','created_at','updated_at','question_img','question_video_link'];
  
  public static function AddClass($data) {
      $row = DB::table('questions')-&gt;insert([
      'quiz_id' =&gt; $data-&gt;quiz_id,
      'question_type_id'  =&gt; $data-&gt;question_type_id,
      'question' =&gt;  $data-&gt;question,
      'a' =&gt;  $data-&gt;a,
      'b' =&gt;  $data-&gt;b,
      'c' =&gt;  $data-&gt;c,
      'd' =&gt;  $data-&gt;d,
      'answer'=&gt; $data-&gt;answer,
      'status'  =&gt; 1,
      'created_at'  =&gt; date('Y-m-d H:i:s'),
      'updated_at'  =&gt; date('Y-m-d H:i:s'),
      'question_img'=&gt; $data-&gt;question_img,
      'question_video_link' =&gt; $data-&gt;question_video_link,
      ]);
      return $row;
  }
  </code></pre>
  <p>This is view code, in this code, I am using one jquery function to display particular type and options</p>
  <pre><code>     @extends('layouts.teacherapp')
  
       @section('content')
       &lt;style&gt;
       .box{
       display:none;
       }
       &lt;/style&gt;
  
  
              &lt;!-- ============================================================== --&gt;
              &lt;!-- End Bread crumb and right sidebar toggle --&gt;
              &lt;!-- ============================================================== --&gt;
              &lt;!-- ============================================================== --&gt;
              &lt;!-- Start Page Content --&gt;
              &lt;!-- ============================================================== --&gt;
              @if(Session::has('success'))
              &lt;div class=&quot;alert alert-success&quot;&gt; &lt;i class=&quot;ti-user&quot;&gt;&lt;/i&gt; {{ 
              Session::get('success') }}
              &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;alert&quot; aria-label=&quot;Close&quot;&gt; &lt;span aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/span&gt; &lt;/button&gt;
                                      &lt;/div&gt;
              @endif                      
              &lt;!-- ============================================================== --&gt;
              &lt;!-- End Bread crumb and right sidebar toggle --&gt;
              &lt;!-- ============================================================== --&gt;
              &lt;!-- ============================================================== --&gt;
              &lt;!-- Start Page Content --&gt;
              &lt;!-- ============================================================== --&gt;
               &lt;div class=&quot;page-wrapper&quot;&gt;
          &lt;!-- ============================================================== --&gt;
          &lt;!-- Title and breadcrumb --&gt;
          &lt;!-- ============================================================== --&gt;
          &lt;div class=&quot;page-titles&quot;&gt;
              &lt;div class=&quot;d-flex align-items-center&quot;&gt;
                  &lt;h5 class=&quot;font-medium m-b-0&quot;&gt;Add Question&lt;/h5&gt;
                  &lt;div class=&quot;custom-breadcrumb ml-auto&quot;&gt;
                      &lt;a href=&quot;#!&quot; class=&quot;breadcrumb&quot;&gt;Home&lt;/a&gt;
                      &lt;a href=&quot;#!&quot; class=&quot;breadcrumb&quot;&gt;Add Question&lt;/a&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
          &lt;!-- ============================================================== --&gt;
          &lt;!-- Container fluid scss in scafholding.scss --&gt;
          &lt;!-- ============================================================== --&gt;
          &lt;div class=&quot;container-fluid&quot;&gt;
              &lt;!-- ============================================================== --&gt;
              &lt;!-- Sales Summery --&gt;
              &lt;!-- ============================================================== --&gt;
              
             
             &lt;div class=&quot;row&quot;&gt;
                  &lt;form class=&quot;add-class&quot; action=&quot;{{url('/teachers/dashboard/storequestion')}}&quot; enctype=&quot;multipart/form-data&quot; method=&quot;post&quot;&gt;
                  {{csrf_field()}}
  
         
  &lt;div class=&quot;row&quot;&gt;
     &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;select name=&quot;quiz_id&quot;&gt;
              &lt;option value=&quot;&quot; disabled selected&gt;Choose Quiz&lt;/option&gt;
              @foreach($quiz as $qui)
              
                  &lt;option value=&quot;{{$qui-&gt;id}}&quot;&gt;{{$qui-&gt;quizname}}&lt;/option&gt; 
              
              @endforeach  
          &lt;/select&gt;
          &lt;label&gt;Select Quiz&lt;/label&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;row&quot;&gt;
     &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;select name=&quot;question_type_id&quot; id=&quot;select&quot;&gt;
              &lt;option value=&quot;&quot; disabled selected&gt;Choose Question Type&lt;/option&gt;
              @foreach($question_type as $questy)
                  &lt;option value=&quot;{{$questy-&gt;id}}&quot; &gt;{{$questy-&gt;question_type_name}}&lt;/option&gt; 
              @endforeach  
          &lt;/select&gt;
          &lt;label&gt;Select Question Type&lt;/label&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  &lt;div id=&quot;DivContent&quot;&gt;
    &lt;div id=&quot;1&quot; class=&quot;div_content&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
         &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;question&quot; type=&quot;text&quot; name=&quot;question&quot;&gt;
          &lt;label for=&quot;question&quot;&gt;Question&lt;/label&gt;
          @if ($errors-&gt;has('question'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('question') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;a&quot; type=&quot;text&quot; name=&quot;a&quot;&gt;
          &lt;label for=&quot;a&quot;&gt;Option A&lt;/label&gt;
          @if ($errors-&gt;has('a'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('a') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;b&quot; type=&quot;text&quot; name=&quot;b&quot;&gt;
          &lt;label for=&quot;b&quot;&gt;Option B&lt;/label&gt;
          @if ($errors-&gt;has('b'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('b') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;c&quot; type=&quot;text&quot; name=&quot;c&quot;&gt;
          &lt;label for=&quot;c&quot;&gt;Option C&lt;/label&gt;
          @if ($errors-&gt;has('c'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('c') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;d&quot; type=&quot;text&quot; name=&quot;d&quot;&gt;
          &lt;label for=&quot;c&quot;&gt;Option D&lt;/label&gt;
          @if ($errors-&gt;has('d'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('d') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
       &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;textarea id=&quot;answer&quot; name=&quot;answer&quot; class=&quot;materialize-textarea&quot;&gt;&lt;/textarea&gt;
          &lt;label for=&quot;answer&quot;&gt;Answer&lt;/label&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;button class=&quot;btn cyan waves-effect waves-light right&quot; type=&quot;submit&quot;&gt;Add Question
          &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;!--fill in the blank part--&gt;
  &lt;div id=&quot;2&quot; class=&quot;div_content&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
         &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;question&quot; type=&quot;text&quot; name=&quot;question&quot;&gt;
          &lt;label for=&quot;question&quot;&gt;Question&lt;/label&gt;
          @if ($errors-&gt;has('question'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('question') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;a&quot; type=&quot;text&quot; name=&quot;a&quot;&gt;
          &lt;label for=&quot;a&quot;&gt;Option A&lt;/label&gt;
          @if ($errors-&gt;has('a'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('a') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
        &lt;/div&gt;
      &lt;/div&gt;
  
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;b&quot; type=&quot;text&quot; name=&quot;b&quot;&gt;
          &lt;label for=&quot;b&quot;&gt;Option B&lt;/label&gt;
          @if ($errors-&gt;has('b'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('b') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;c&quot; type=&quot;text&quot; name=&quot;c&quot;&gt;
          &lt;label for=&quot;c&quot;&gt;Option C&lt;/label&gt;
          @if ($errors-&gt;has('c'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('c') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;d&quot; type=&quot;text&quot; name=&quot;d&quot;&gt;
          &lt;label for=&quot;c&quot;&gt;Option D&lt;/label&gt;
          @if ($errors-&gt;has('d'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('d') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
       &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;textarea id=&quot;answer&quot; name=&quot;answer&quot; class=&quot;materialize-textarea&quot;&gt;&lt;/textarea&gt;
          &lt;label for=&quot;answer&quot;&gt;Answer&lt;/label&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;button class=&quot;btn cyan waves-effect waves-light right&quot; type=&quot;submit&quot;&gt;Add Question
          &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;!--fill in the blank part--&gt;
    &lt;!--1-2 word Answer --&gt;
    &lt;div id=&quot;3&quot; class=&quot;div_content&quot;&gt;
      &lt;div class=&quot;row&quot;&gt;
         &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;input id=&quot;question&quot; type=&quot;text&quot; name=&quot;question&quot;&gt;
          &lt;label for=&quot;question&quot;&gt;Question&lt;/label&gt;
          @if ($errors-&gt;has('question'))
                  &lt;small class=&quot;form-control-feedback&quot;&gt;
                  &lt;strong&gt;{{ $errors-&gt;first('question') }}&lt;/strong&gt;
                  &lt;/small&gt;
              @endif
         &lt;/div&gt;
      &lt;/div&gt;
      
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;textarea id=&quot;answer&quot; name=&quot;answer&quot; class=&quot;materialize-textarea&quot;&gt;&lt;/textarea&gt;
          &lt;label for=&quot;answer&quot;&gt;Answer&lt;/label&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class=&quot;row&quot;&gt;
        &lt;div class=&quot;input-field col s12&quot;&gt;
          &lt;button class=&quot;btn cyan waves-effect waves-light right&quot; type=&quot;submit&quot;&gt;Add Question
          &lt;/button&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;!--1-2 word Answer --&gt;
   &lt;!--True or False--&gt;
      
    &lt;div id=&quot;4&quot; class=&quot;div_content&quot;&gt;
    &lt;div class=&quot;row&quot;&gt;
       &lt;div class=&quot;input-field col s12&quot;&gt;
        &lt;input id=&quot;question&quot; type=&quot;text&quot; name=&quot;question&quot;&gt;
        &lt;label for=&quot;question&quot;&gt;Question&lt;/label&gt;
       @if ($errors-&gt;has('question'))
      &lt;small class=&quot;form-control-feedback&quot;&gt;
      &lt;strong&gt;{{ $errors-&gt;first('question') }}&lt;/strong&gt;
      &lt;/small&gt;
    @endif
       &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;input-field col s12&quot;&gt;
        &lt;input id=&quot;a&quot; type=&quot;text&quot; name=&quot;a&quot;&gt;
        &lt;label for=&quot;a&quot;&gt;True&lt;/label&gt;
  @if ($errors-&gt;has('a'))
      &lt;small class=&quot;form-control-feedback&quot;&gt;
      &lt;strong&gt;{{ $errors-&gt;first('a') }}&lt;/strong&gt;
      &lt;/small&gt;
    @endif
      &lt;/div&gt;
    &lt;/div&gt;
  
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;input-field col s12&quot;&gt;
        &lt;input id=&quot;b&quot; type=&quot;text&quot; name=&quot;b&quot;&gt;
        &lt;label for=&quot;b&quot;&gt;False&lt;/label&gt;
  @if ($errors-&gt;has('b'))
      &lt;small class=&quot;form-control-feedback&quot;&gt;
      &lt;strong&gt;{{ $errors-&gt;first('b') }}&lt;/strong&gt;
      &lt;/small&gt;
    @endif
      &lt;/div&gt;
    &lt;/div&gt;
  
    
    &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;input-field col s12&quot;&gt;
    &lt;textarea id=&quot;answer&quot; name=&quot;answer&quot; class=&quot;materialize-textarea&quot;&gt;&lt;/textarea&gt;
    &lt;label for=&quot;answer&quot;&gt;Answer&lt;/label&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;div class=&quot;row&quot;&gt;
      &lt;div class=&quot;input-field col s12&quot;&gt;
        &lt;button class=&quot;btn cyan waves-effect waves-light right&quot; type=&quot;submit&quot;&gt;Add Question
        &lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;!--True or False--&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
           &lt;script src=&quot;https://code.jquery.com/jquery-3.6.0.js&quot;&gt;&lt;/script&gt;
           &lt;script&gt;
           $(document).ready(function(){
  
              //hides dropdown content
               $(&quot;.div_content&quot;).hide();
  
              //unhides first option content
               $(&quot;#DivContent:first&quot;).show();
  
               //listen to dropdown for change
                $(&quot;#select&quot;).change(function(){
               //rehide content on change
                $('.div_content').hide();
               //unhides current item
                $('#'+$(this).val()).show();
                 });
  
                });
               &lt;/script&gt;    
              &lt;!-- ============================================================== --&gt;
              &lt;!-- End PAge Content --&gt;
              &lt;!-- ============================================================== --&gt;
                              
             @endsection
  </code></pre>