optional argument in Laravel route

Occasionally you may need to specify a route parameter that may not always be present in the URI. You may do so by placing a ? mark after the parameter name. Make sure to give the route’s corresponding variable a default value:

Route::get('/user/{name?}', function ($name = null) {
    return $name;
});

Route::get('/user/{name?}', function ($name = 'John') {
    return $name;
});

synchronous get request JavaScript

How to make a synchronous GET request in JavaScript?

<script>
localStorage.language="calendar_main";
function SignName(sign_id,id){
  var form = new FormData();
  var settings = {
  "url": "/api/api-function/"+sign_id+"/"+localStorage.language+"",
  "method": "GET",
  "timeout": 0,
  "headers": {
    
  },
  "processData": false,
  "mimeType": "multipart/form-data",
  "contentType": false,
  "data": form,
  "async": false,
};

$.get(settings).done(function (response) {
  const obj = JSON.parse(response);
  var sign=obj['data'];
  //console.log(data);
  for(i in sign)
  {
    $("#sign"+id).append(sign[i]['name']);

  }
  
});
}

$(document).ready(function(){
                $(document).ajaxSuccess(function(){
                   // console.log("AJAX request successfully completed.");
                });
                $(document).ajaxError(function (event, jqxhr, settings) {
                    console.log("AJAX error.");
                    if (settings.url == "") {
         
                    }
                });  
                
            });
      
</script>
use async: false in your data

group by with like in laravel 8

$results = User::select(\DB::raw('YEAR(date) as year, COUNT(id) as amount'))
    ->groupBy(\DB::raw('YEAR(date)'))
    ->get();

So, we’re using DB::raw() for all select statement, also repeating the same condition in groupBy(). Here’s the visual result for my dummy seeded data:

Here’s how you can find PAN Card Number Online

Lost your PAN card? Here’s how you can download instant e-PAN

Lost your PAN card? Here’s how you can download instant e-PAN

A Permanent Account Number (PAN) card is considered one of the most important financial documents for the citizens of India as it helps a person with filing their income tax return. The PAN card not only facilitates KYC but helps with many day-to-day services, such as opening a bank account, obtaining a debit or credit card, carrying out huge money-related transactions.

It is a 10-character alphanumeric identification number assigned to all tax-payers in India. But what happens if you end up misplacing or losing it?

PAN card holders can download an instant e-PAN or digital version of their PAN card using the online facility of the income tax department. The entire procedure is user-friendly and it just uses your Aadhaar number and hardly takes 10 minutes.

Steps to download instant e-PAN

Step 1: Visit the official website of Income Tax e-filing https://www.incometax.gov.in.

Step 2: Under the section “Our Services”, search for the option ‘Instant e-PAN’.

Step 3: If you have downloaded e-PAN earlier, click on the ‘Check Status/Download e-PAN’ option, but you need to click on the ‘Get new e-Pan’ option if you haven’t downloaded e-PAN in the past.

Step 4: You must choose as per your requirement from the given options and then click on continue.

Step 5: Now, the page will open asking you to enter your 12-digit Aadhaar number. So, enter your Aadhaar number in the input field.

Step 6: As soon as you enter your Aadhaar number, the page will display a declaration, you need to click on continue.

Step 7: Next, an OTP will be sent to your registered or Aadhar-linked mobile number.

Step 8: Then, enter the OTP you have received on your mobile in the given field.

Step 9: The page will now display all your details. After checking all the information carefully, enter your email address in the specified field.

Step 10: You will soon receive your e-PAN in your email inbox. You can also get your e-PAN printed.

Point to note: If you have your PAN number, you can also download your e-PAN from the websites of UTIITSL or TIN-NSDL, depending upon where your original PAN card was generated.

The digital version of the PAN card or e-PAN is equally valid and can be used in the place of the original PAN card.

source:indiatoday

Select and deselect multiple checkbox and store date into JavaScript set for unique value

<form method="post" action="/live-yearly" enctype="multipart/form-data">
<input type="hidden" name="_token" value="{{ csrf_token() }}" />
<input type="hidden" name="selectedLiveValue" id="selectedLiveValue" required>
<input type="submit" value="Live">
</form>
 <th><input type="checkbox" id="selectAll"></th>
  <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
  <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
  <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
  <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
<script>
 var  selectedIds = new Set();


$(document).ready(function() {
$("#selectAll").click(function(){

if(! $(this).prop("checked")) {
              $(".id").prop("checked", false);
              $("#selectedLiveValue").val("");
              selectedIds.clear();
          } else {
              $(".id").prop("checked", true);
              $('input[name="ids"]:checked').each(function() {  
   selectedIds.add(this.value);
   selectedIds.forEach(function(value) {
  $("#selectedLiveValue").val(value+","+$("#selectedLiveValue").val());
});
});
   }  
        //  console.log($('input[name="ids"]:checked').serialize());
});


});

$(".id").click(function(){
  $("#selectedLiveValue").val("");
  if( $(this).prop("checked")) {
    selectedIds.add($(this).val());
  }else{
    selectedIds.delete($(this).val());
  }

selectedIds.forEach(function(value) {
  $("#selectedLiveValue").val(value+","+$("#selectedLiveValue").val());
});

});


  </script>

javascript:void(0)

Usage of javascript:void(0) means that the author of the HTML is misusing the anchor element in place of the button element. Anchor tags are often abused with the onclick event to create pseudo-buttons by setting href to “#” or “javascript:void(0)” to prevent the page from refreshing.

Get value of selected checkbox jQuery

    <th><input type="checkbox" id="selectAll"></th>
     <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
     <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
     <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
     <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
     <td><input type="checkbox" class="id" value="{{ $d->id }}" name="ids" ></td>
$(document).ready(function() {
$("#selectAll").click(function(){

if( $(this).prop("checked")) {
              $(".id").prop("checked", false);
          } else {
              $(".id").prop("checked", true);
          }  

          console.log($('input[name="ids"]:checked').serialize());

//OR


          $('input[name="ids"]:checked').each(function() {
   console.log(this.value);
});

});
});

how to remove sorting option from datatables

 $(document).ready(function() {

    $('#example').DataTable( {
      "aoColumnDefs": [
          { 'bSortable': false, 'aTargets': [ 0 ] }
       ]
      
  });

});
 $(document).ready(function() {

    $('#example').DataTable( {
  
       "columnDefs": [
        { "orderable": false, "targets": [1] }
    ]
  });

});

Select all checkbox jQuery

  <th><input type="checkbox" id="selectAll"></th>
<input type="checkbox" class="id" >
<input type="checkbox" class="id" >
<input type="checkbox" class="id" >
<script>

$(document).ready(function() {
$("#selectAll").click(function(){

if( $(this).prop("checked")) {
              $(".id").prop("checked", false);
          } else {
              $(".id").prop("checked", true);
          }

});
});

  </script>