samedi 15 octobre 2022

Send notification to creator on the basis of post page views in laravel?

I want to send the notification to the post creator on the basis of page views in laravel. Like when the post gets 1000 views, the creator should get a congratulatory notification. Here the problem is I am using cookies(2 hours) to prevent multiple page views. so the creator gets multiple notifications until views are moved to 1001.

if($views == 1000){
        $user = User::find($userid);
        $notificationdetails = [
          'subject' => 'Congratulations, You got your first '.$views. ' views on your new snippet - '.$snippet_title,
          'greeting' => 'Hi, '.$user->name,
          'body' => 'Congratulations, You got your first '.$views. ' views on your new 
     snippet - '.$snippet_title,
          'body1' =>'',
          'thanks' => ' ',
          'actionText' => 'View snippet',
          'actionURL' => url(env('FRONTEND_URL').'/snippets/'.$slug)
                 ];
          Notification::send($user, new BBBnotifications($notificationdetails));

    }


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/tQanZPY
via IFTTT

mercredi 12 octobre 2022

composer 1 out of memory - impossible to update to 2

Everytime I try to install a new package on my webserver, I run into composer error (after very long delay). What is the solution? What is the work around?

 pgodard@dedi13:~/public_html$ composer require setasign/fpdf:^1.8
 Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
 Info from https://repo.packagist.org: #StandWithUkraine
 ./composer.json has been updated
 Loading composer repositories with package information
 Warning from https://repo.packagist.org: Support for Composer 1 is deprecated and some packages will not be available. You should upgrade to Composer 2. See https://blog.packagist.com/deprecating-composer-1-support/
 Info from https://repo.packagist.org: #StandWithUkraine
 Updating dependencies (including require-dev)
 
 Fatal error: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 12288 bytes) in phar:///usr/bin/composer/src/Composer/DependencyResolver/RuleSetGenerator.php on line 64
 
 Check https://getcomposer.org/doc/articles/troubleshooting.md#memory-limit-errors for more infopgpgppgodard@dedi13:~/public_html$ 

If I try to update composer, I get another error...

pgodard@dedi13:~/public_html$ composer selfupdate --2
Updating to version 2.4.2 (2.x channel).
Downloading (100%)                                                
[Composer\Downloader\FilesystemException]                            
Filesystem exception:                                                
Composer update failed: "/usr/bin/composer" could not be written.    
rename(/usr/bin/composer): Failed to open stream: Permission denied  
 

On my local webserver on my mac, it works 100%.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/pFYBaen
via IFTTT

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.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/Rvu9ECP
via IFTTT

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>


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/cQVDxb8
via IFTTT

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



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/q0B9liF
via IFTTT

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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/uGFmChw
via IFTTT

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?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/MKYVh8q
via IFTTT