mercredi 12 octobre 2022

Laravel show pdf file in mobile device

I'm working on Laravel project where I have private url for pdf file like: http://10.10.1.10/dummy.pdf When I am using iframe to show pdf in mobile device, it is showing me download option instead showing pdf. I also checked online their peoples are suggesting google pdf viewer but due to private pdf url I cannot use the same. Please suggest a way that how can I achieve the same.



via Chebli Mohamed

mardi 11 octobre 2022

fill dynamic input with select html

I am trying to make a dynamic form which consists of being able to add rows dynamically and the same with a select I take the values ​​of the select and put them in the inputs of the first row, I would like to know how to fill in the other selects because it only works for me with the first row my select

enter image description here

function cambioOpciones(e) {
  const combo = document.getElementById('opciones'),
    [FECHA, MONEDA, NUMCTA, FAMILIA, CONCEPTO, FACTURA, DENOMINACION_SOCIAL, VENDEDOR] = document.getElementById('opciones').value.split('_');
  document.getElementById('fecha').value = FECHA;
  document.getElementById('moneda').value = MONEDA;
  document.getElementById('numcta').value = NUMCTA;
  document.getElementById('familia').value = FAMILIA;
  document.getElementById('Concepto').value = CONCEPTO;
  document.getElementById('showId').value = FACTURA;
  document.getElementById('denominacion').value = DENOMINACION_SOCIAL;
  document.getElementById('vendedor').value = VENDEDOR;
}

$(document).ready(function() {
  let row_number = 1;
  $("#add_row").click(function(e) {
    e.preventDefault();
    let new_row_number = row_number - 1;
    $('#venta' + row_number).html($('#venta' + new_row_number).html()).find('td:first-child');
    $('#ventas_table').append('<tr id="venta' + (row_number + 1) + '"></tr>');
    row_number++;
  });
  $("#delete_row").click(function(e) {
    e.preventDefault();
    if (row_number > 1) {
      $("#venta" + (row_number - 1)).html('');
      row_number--;
    }
  });
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
<td>
  <select name="products[]" class="form-control" id="opciones" onchange='cambioOpciones();'>
    @foreach ($ventas1 as $ventas)
    <option value="_______">
      ---
    </option>
    @endforeach
  </select>
</td>


via Chebli Mohamed

Yajra datatable regenerate issue in Laravel 6

I am using laravel 6 and trying to regenerate yajra datatable by following

    var dataTable = $('#my_list').dataTable();
    dataTable.fnDestroy();
    getMyList();

It's working. But First of all it shows broken table(during data population) after that table become nicely visible. Here is my data-table configuration

DataTable({
       iDisplayLength: 15,
       processing: true,
       serverSide: true,
       lengthChange: false,
       searching: true,
       paging: true,
       ajax: 

How can I overcome this or introduce preloader during fetching data



via Chebli Mohamed

lundi 10 octobre 2022

How to Only Show Video in Instagram Embed Code?

I am using Laravel 5 and My client wants me to set and input in his admin page to add embedded Instagram videos code.

But does not want to show title, likes and other information.

Just plain video with autoplay.

I found out that you can just eliminate those pieces in the code Instagram gives you but my client just want to copy-paste.

Is there a way around this?



via Chebli Mohamed

samedi 8 octobre 2022

Append digital sign in existing pdf in laravel

I am doing a project in laravel 6 and trying to add digital signature in uploaded pdf file (in a specific page). Is there any free package for php ? Thanks in advance



via Chebli Mohamed

jeudi 6 octobre 2022

Laravel mailer single authentication

I use Laravel 5.8.
In one of my scripts, a mail might be sent inside a very big loop. I use the following code :

Mail::send("myTemplate", $data, function (Message $m) use ($toAddress, $emailSubject) {
    $m->from(env("MAIL_USERNAME"), env("MAIL_FROM_NAME"));
    $m->to($toAddress, $toAddress)->subject($emailSubject);
});

My problem is that in some moment email server complains about too many authentications, and reject attempt to send mail.

Is there any way to avoid authentication on each delivery, and instead having one single authentication?



via Chebli Mohamed

Mongodb responding only after connectTimeoutMS

We have 3 web servers load balanced using HAproxy. Out of these 3, 2 are responding to any MongoDB queries as soon as possible but on the 3rd web server, it takes time up to the configured connectTimeoutMS (which is 10 seconds in our case). This happened all of sudden on this server. Before it was also working as normal as the other 2 web servers. We tried our best to check logs and everything but could not find the reason behind this. What could be the reason?



via Chebli Mohamed