raza9355

raza9355

Member Since 1 Month Ago

Experience Points
190
Total
Experience

4,810 experience to go until the next level!

In case you were wondering, you earn Laracasts experience when you:

  • Complete a lesson — 100pts
  • Create a forum thread — 50pts
  • Reply to a thread — 10pts
  • Leave a reply that is liked — 50pts
  • Receive a "Best Reply" award — 500pts
Lessons Completed
0
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start your engines Created with Sketch.

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • first-thousand Created with Sketch.

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • 1-year Created with Sketch.

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • 2-years Created with Sketch.

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • 3-years Created with Sketch.

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • 4-years Created with Sketch.

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • 5-years Created with Sketch.

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • school-in-session Created with Sketch.

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • welcome-newcomer Created with Sketch.

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • full-time-student Created with Sketch.

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • pay-it-forward Created with Sketch.

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • subscriber Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • evangelist Created with Sketch.

    Laracasts Evangelist

    Earned if you share a link to Laracasts on social media. Please email [email protected] with your username and post URL to be awarded this badge.

  • chatty-cathy Created with Sketch.

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • lara-veteran Created with Sketch.

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • 10k-strong Created with Sketch.

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • lara-master Created with Sketch.

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • laracasts-tutor Created with Sketch.

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • laracasts-sensei Created with Sketch.

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • top-50 Created with Sketch.

    Top 50

    Earned once your experience points ranks in the top 50 of all Laracasts users.

Level 1
190 XP
Sep
18
1 month ago
Activity icon

Started a new Conversation Store Multiple Data In Multiple Column On Post Laravel

this is my controller what i have tried

 public function getTranslation(Request $request){

    
    $dataa = new trans();
    $lang = new language();
    $data = $request->all();
    
    foreach ($request->get('translation')  as $key=>$translation):
      
        $detail = $dataa;
        $detail['translation.'.$key];
        $detail->translation = $translation;
        dd($detail);
    endforeach;
}

this is ajax

jQuery(document).ready(function () {
                  $('#saveBtn').on('click', function (e) {
                    var access = [];
          $('input[name^="translation"]').each(function() {
              access.push(this.value);
          });
                      var value = $("#ajax-crud-modal").find('input[name="post_id"]').val();
                      console.log(value);
                      e.preventDefault();
                      $.ajaxSetup({
                          headers: {
                              'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
                          }
                      });
                      $.ajax({
                          url: '{{ url("/surname/translation") }}',
                          type: 'POST',
                          data: {
                            ethnicity: $('[name=ethnicity]').val(),
                            translation: access,
                          
                          },
                          
                          success: function (result, exception) {
                            $('#ajax-crud-modal').modal('hide');
                          

                          },
                          error: function (jqXHR, exception) {
                              alert(jqXHR.status + ' - ' + exception);
                          }
                      });
                  });
              });

this is the ajax i am sending to the controller from translation i am getting array i want to add that store data of array on new column like when i post data all fields value will save in new column in db i dont know how to achieve that from controller i am new to laravel help will be appreciated

Sep
15
1 month ago
Activity icon

Replied to Laravel Request Getting Null Value

Silly me @ismaile thanks for the help

Activity icon

Replied to Laravel Request Getting Null Value

when i was posting here i just forgot to ctrl z checking with uppercase and lowercase but no response still null i already checked that @ismaile

Activity icon

Replied to Laravel Request Getting Null Value

still not working @ismaile

Activity icon

Started a new Conversation Laravel Request Getting Null Value

This is the Update function

public function update(Request $request, $id)
   {
    
     $data = Post::find($id);
     $data->post_content = $request->posts;
        
     dd($request->posts);
    $data->save();  
  
  }

here $request->posts getting null value

       <form  class="form-horizontal"> 
       
        {{-- @method('PUT')
        @csrf --}}
    <div class="modal-content">
       
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
     <textarea name="posts"  type="text" class="form-control" id="name"   value="" maxlength="50" required=""></textarea>
     <input type="text" name="post_id" id="post_id" value="">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary update" id="saveBtn">Update</button>
      </div>
    </div>
        </form>
  </div>
</div>

here is the textarea i am trying to get value from text area and its value is coming from ajax get

 	 $('body').on('click', '#edit-post', function () {
//      var message = $('#post_content', this).text();

  	var user_id = $(this).data('id');
  	$.get('edit/'+ user_id+'', function (data) {
     $('#userCrudModal').html("Edit User");
      $('#btn-save').val("edit-user");
      $('#ajax-crud-modal').modal('show');

      $('#name').val(data[0]['post_content']);
      $('#post_id').val(data[0]['id']);
    
  	})
})

and below is for updating route

	       jQuery(document).ready(function () {
    $('#saveBtn').on('click', function (e) {
        var value = $("#ajax-crud-modal").find('input[name="post_id"]').val();
        console.log(value);
        e.preventDefault();
        $.ajaxSetup({
            headers: {
                'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
            }
        });
        $.ajax({
            url: '{{ url("user/show/update") }}' + '/' + value,
            type: 'POST',
            data: {
                
            },
            dataType: 'json',
            success: function (result, exception) {
            },
            error: function (jqXHR, exception) {
                alert(jqXHR.status + ' - ' + exception);
            }
        });
    });
});

So i am new to laravel and now i am stuck everything working fine but getting null value of post content for what reason i am stuck

Activity icon

Replied to Simple Question How Can I Get Input Value

I want it that way because when i am getting id in existing way its getting the static id so i pass the id of specific post in input field in modal now i got a problem how can i get the input value in the action of form so how can i solve this problem

Activity icon

Started a new Conversation Simple Question How Can I Get Input Value

I am new to laravel and i am stuck i am trying to edit most from the model this is my code

       <form  method="POST" class="form-horizontal" action="{{ route('frontusers.update',$datas[0]->id)}}"> 
       

problem in the above code i want to get input value post_id instead of $datas[0]->id is there any way that i can get a input value in the action with the url

@method ('PUT')

@csrf

    <div class="modal-content">
       
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Modal title</h5>
        <button type="button" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body">
     <textarea type="text" class="form-control" id="name" name="post_content"  value="" maxlength="50" required=""></textarea>
     <input type="text" name="post_id" id="post_id" value="">
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
        <button type="submit" class="btn btn-primary update" id="saveBtn">Update</button>
      </div>
    </div>
        </form>
  </div>
</div>