consil

consil

Member Since 4 Years Ago

Whitley Bay

Experience Points
28,250
Total
Experience

1,750 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
254
Lessons
Completed
Best Reply Awards
0
Best Reply
Awards
  • start-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-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-token Created with Sketch.

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • lifer-token Created with Sketch.

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • lara-evanghelist 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 6
28,250 XP
Oct
17
1 month ago
Activity icon

Replied to Job Dispatch Options - How Does This Actually Work?

It looks like it is the destructor that does the actual despatching, see:

https://github.com/laravel/framework/blob/e04a7ffba8b80b934506783a7d0a161dd52eb2ef/src/Illuminate/Foundation/Bus/PendingDispatch.php#L110

It's an interesting concept, a class that does not do anything until it goes out of scope. But it makes perfect sense. So dispatch() does not actually dispatch a job, but it creates a job pending dispatch, and you can keep tweaking it until it is destroyed.

The more you understand, the more you can make Laravel bend to your will. Love it :-)

Oct
15
1 month ago
Activity icon

Replied to Database Transaction Or Query->save() ?

Note that the return value of save() is not success/fail. It simply tells you whether the database was updated or not. It may not be updated if there is nothing changed in your model, which can't really be described as a fail. However, you may have pre-save validation checks that can prevent saving, and those could be considered a fail. Just use with caution.

Oct
09
1 month ago
Activity icon

Replied to Job Dispatch Options - How Does This Actually Work?

Note that I can either add the options to the job, then dispatch that when all the options are set up. That makes sense to me if the dispatch() function "does the deed".

But dispatching the job then adding the options also works, and that is how it is documented in most of the Laravel docs. That makes no sense to me, unless something is happening under the bonnet that I'm not aware of. I guess the destructor of the queue object could do it - as soon as the dispatched job object is out of scope, it will be cleaned up by PHP, and it could throw itself onto a queue as its last desperate act. Is that how it works?

Activity icon

Started a new Conversation Job Dispatch Options - How Does This Actually Work?

This is something I am trying to wrap my head around, and I'm sure I am simply missing something really simple.

I can dispatch a job like this:

dispatch(new MyJob());

That dispatches to the default connector and queue (assuming the job itself does not fiddle with those details).

I can also add some options:

dispatch(new MyJob())->onConnection('database');

and more:

dispatch(new MyJob())->onConnection('database')->onQueue('fast-queue');

So, each option that is added, returns either a new object or updates the queue object. That makes sense.

What I don't understand, is at what point the job actually gets queued. There is no final "do it now" method like there is for eloquent (e.g. ->save() or ->get()). So when does the music stop with this one? How do I actually get to keep adding options before the job finally ends up on the queue. What puts it onto the queue - is it the destructor of the app maybe? Puzzled.

Oct
02
1 month ago
Activity icon

Replied to Logs Not Formatted As JSON When Run From A Container

Hmm, just found the problem. It actually WAS all working, but the tool I was using to view the log entries that were being sent to elk, was stripping out all the JSON. Doh.

Activity icon

Started a new Conversation Logs Not Formatted As JSON When Run From A Container

This is a strange one I can't wrap my head around.

We have a php-fpm container that runs lumen. php-fpm is set to catch stderr from the PHP workers and send it to the container stderr (that's /proc/1/fd/2) and that works.

Now I have set up a logging channel to format all log entries as JSON and send them to stderr (that's stderr for the PHP worker). The log channel looks like this:

    use Monolog\Handler\StreamHandler;

    'stderr-json' => [
        'driver' => 'monolog',
        'handler' => StreamHandler::class,
        'with' => [
            'stream' => 'php://stderr',
        ],
        'formatter' => Monolog\Formatter\JsonFormatter::class,
    ],

Running a PHP artisan command from a shell in the container to log an error, I can see the full error details being returned to my shell as formatted JSON. That works well too.

But when the nginx container runs a php-fpm worker in the php-fpm container, the logs it gets are not formatted at all - just the plain log text message.

What could be happening?

Aug
23
2 months ago
Activity icon

Commented on Reduce A Query From 12 Seconds To 1 Millisecond

It's not about year(). The point is that ANY function that is used in a where clause will be executed for every single matching row that needs to be checked, whether that row is in the final result or not.

Jul
31
3 months ago
Activity icon

Replied to Laravel Cache (where Expiry Time Is Set?)

Old, old thread, but just for anyone coming across it - cache times from Laravel 5.8 is specified in seconds. This is to fall in line with other libraries and PSRs.