frapto

frapto

Member Since 3 Weeks Ago

Experience Points
4,540
Total
Experience

460 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
43
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
4,540 XP
Oct
17
2 weeks ago
Activity icon

Replied to Is There A Way To Get The Uuid Of A Job?

@bugsysha yes but I am not using the job class, i have updated the question with my job implementation. I am implementing the shouldQueue. I tried extending job but it would throw a casting error

Activity icon

Started a new Conversation Is There A Way To Get The Uuid Of A Job?

Hello, I am using the database queue driver and i can see the uuid in the payload. Is there a way i can get the uuid without querying the table? (prior to insertion) This is my current implementation

<?php

namespace App\Jobs;

use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use Illuminate\Support\Facades\App;

class myJob implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $userData;
    protected $filename;
    public $timeout = 1200;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($userData, $filename)
    {
        //init
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        //do something here
    }
}

I tried extending the Job abstract class, but it throws a class cast exception

Oct
16
2 weeks ago
Activity icon

Awarded Best Reply on Laravel Snappy Not Rendering Headers And Footers And Ignoring My Css?

It turned out I needed to use the qt patched version rather than the normal one.

Activity icon

Replied to Laravel Snappy Not Rendering Headers And Footers And Ignoring My Css?

It turned out I needed to use the qt patched version rather than the normal one.

Oct
15
2 weeks ago
Activity icon

Started a new Conversation Laravel Snappy Not Rendering Headers And Footers And Ignoring My Css?

Hi, after my last question regarding the timeouts, i switched to linux (ubuntu 20.04 LTS to be specific) so the pcntl libraries work. However this brought more problems. I installed snappy and fixed the wkhtmltopdf paths but suddenly headers and footers are not getting rendered. This is my controller code

public function createPDF(){
        $pdf = App::make('snappy.pdf.wrapper');
        $footer = \view('supporting.footer')->render();
        $header = \view('supporting.header')->render();
        $userData = \collect([$this->userData[1]]); //just for faster rendering and testing
        $pdf->loadView('orders', ['users' => $userData])
        ->setOption('margin-top', '20mm')
        ->setOption('margin-bottom', '20mm')
        ->setOption('minimum-font-size', 25)
        ->setOption('header-html', $header)
        ->setOption('footer-html', $footer);
        $pdf->save($this->path);
}

my header view:

<!DOCTYPE html>
<html lang="en">
<head>

</head>
<body>
    <div style="background: blanchedAlmond;color:green;">My Header is amazing<div>
</body>
</html>

This is my footer view:

<!DOCTYPE html>
<html lang="en">
<head>
</head>
<body>
    <div style="background: blanchedalmond; color:green;">Copyright &copy; 2020</div>
</body>
</html>

My orders view: (just some basic tables)

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Order Layout</title>
    <style>
        *{
            font-family: cursive;
        }

        .wrapper {
            display: block;
        }

        .invoice {
            display: block;

            width: 80%;
            margin: 0 auto;
            margin-top: 10px;
            padding-top: 10px;
            padding-bottom: 10px;
            background: #d3d3d3;
            page-break-inside: avoid !important;
            padding-left: 20px;
        }

        .order-items {
            padding-left: 100px;
        }

        .table {
            width: 90%;
            align-self: center;
            border: 1px solid black;
            page-break-inside: avoid !important;
            orphans: 15;
        }
        .table>* {
            text-align: center;
        }
    </style>
</head>

<body>

    <main class="wrapper">
        @foreach ($users as $user)

        @php
        $orders = $user->orders //just for renaming
        @endphp
        @foreach ($orders as $order)
        
        <div class="invoice">
            @php
            $sum=0;
            @endphp
            <h2>{{$user->name}}: {{$order->id}}</h2>
            <div class="order-items">
                <table class="table" border="1">
                    <thead>
                        <tr>
                            <th>Product Name</th>
                            <th>Unit Price</th>
                            <th>Qty</th>
                            <th>subtotal</th>
                        </tr>
                    </thead>
                    <tbody>
                        @foreach ($order->products as $product)
                        <tr>
                            <th>
                                {{$product->name}}<br>
                            </th>
                            <td>{{$product->unit_price}}</td>
                            <td>{{$product->pivot->quantity}}</td>
                            @php
                            $sum+= $product->pivot->quantity*$product->unit_price
                            @endphp
                            <td>{{$product->pivot->quantity*$product->unit_price}}</td>
                        </tr>
                        @endforeach
                    </tbody>
                    <tfoot>
                        <tr>
                            <th colspan="3">Total:</th>
                            <td>{{$sum}}</td>
                        </tr>
                    </tfoot>
                </table>
            </div>
        </div>
        @endforeach
        @endforeach
    </main>
</body>

</html>

This is the pdf layout comparison is on: https://imgur.com/a/ySpSjJN

No headers and footers getting generated, and table headers are not repeated when table is broken across pages

I have not changed anything in the code, I have no idea why it suddenly broke and how can i fix it? I tried multiple css properties, routes, and other stuff and had no luck with any.

I'm open to switching libraries. Though my pdf may be large (currently 3000 pages roughly but may grow or shrink), dompdf simply doesnt work, tcpdf has unclear documentation, and mpdf is too slow.

Thank you

Activity icon

Replied to Queue Timeout: Symfony Process Keeps Timing Out At 60s Ignoring My Settings

it also turned out that i needed to switch to linux (i was on windows using xampp before) so symfony could make use of the pcntl library

Oct
13
2 weeks ago
Activity icon

Replied to Queue Timeout: Symfony Process Keeps Timing Out At 60s Ignoring My Settings

Hi, no i dont use it. In my handle method i use a call to laravel snappy to generate a large pdf. I updated the question with my job class

Oct
12
2 weeks ago
Activity icon

Started a new Conversation Queue Timeout: Symfony Process Keeps Timing Out At 60s Ignoring My Settings

why is my queue job timing out? I am using database as a driver I tried the following:

class PdfGenerator implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    protected $userData;
    protected $filename;
    protected $path;
    public $timeout = 1200;
    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($userData, $filename)
    {
        //
        $this->userData = $userData;
        $this->filename = $filename;
        $this->path = \public_path('\pdfs\'.$this->filename.'.pdf');
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $pdf = App::make('snappy.pdf.wrapper');
        $footer = \view('supporting.footer')->render();
        $header = \view('supporting.header')->render();
        //$userData = \collect([$this->userData[1]]);
        $pdf->loadView('order_clean', ['users' => $this->userData])
        ->setOption('margin-top', '20mm')
        ->setOption('margin-bottom', '20mm')
        ->setOption('minimum-font-size', 25)
        ->setOption('header-html', $header)
        ->setOption('footer-html', $footer);
        $pdf->save($this->path);
    }
}
php artisan queue:work --timeout=1200
php artisan queue:listen --timeout=0

yet my queue job still fails due to timeout of 60s according to the logs because the symfony process timed out. I am not using supervisor yet, just trying out how the queue works from the console