tuitionio

tuitionio

Member Since 4 Years Ago

Experience Points
2,475
Total
Experience

2,525 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
28
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 1
2,475 XP
Jul
17
4 years ago
Activity icon

Replied to Laravel 5.1 - Change Log Filename

I think it failed because I put it into a folder called Loggers instead of using Bootstrap. Not sure why the hell that wouldn't work, but it didn't. I just changed it to Bootstrap. Maybe somewhere deep down that's what Laravel's expecting. No idea. But at least it works now.

Activity icon

Replied to Laravel 5.1 - Change Log Filename

Hmm, when I try your method I get this error when I hit any web page that uses Log class:

Fatal error: Uncaught exception 'ReflectionException' with message 'Class log does not exist' in /Users/me/Sites/myapp/vendor/laravel/framework/src/Illuminate/Container/Container.php:736

Jul
11
4 years ago
Activity icon

Started a new conversation Laravel Queue Failure Does Not Trigger Failed() Method If There's An Exception, But RaiseFailedJobEvent() Works

I am testing the queue functions in Laravel 5.1. I can make jobs queue up in my db table, called jobs, and I can get them to run successfully. I also created a queue failure table called failed_jobs. To test failures, inside the jobs table I manipulate the payload data to make it fail then I run the queue worker daemon like so, so it will put the job in the failed_jobs table after one failed attempt:

php artisan queue:work --daemon --tries=1 --queue=myqueue

When the job fails it is immediately put into failed_jobs table as expected.

I have registered my queue failure event in the AppServiceProvider's boot() method as outlined in the docs:

 Queue::failing(function ($connection, $job, $data) {

            Log::error('Job failed!');
        });

I have also tried the failed() method inside the actual job scripts like so:

        /**
         * Handle a job failure.
         *
         * @return void
         */
         public function failed()
         {
             Log::error('failed!');
        }

Either way, neither of these events is triggered when the queued job fails. I see nothing in the logs except for the exception stack trace which I made occur on purpose when I corrupted the job payload data:

Stack trace: #0 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->handleError(8, 'unserialize():

So I did some research. When a queue job failure occurs, the logic for handling that failure is in vendor/laravel/framework/src/Illuminate/Queue/Worker.php:

 protected function logFailedJob($connection, Job $job)
    {

    if ($this->failer) {

        $this->failer->log($connection, $job->getQueue(), $job->getRawBody());

        $job->delete();

        $job->failed();

        $this->raiseFailedJobEvent($connection, $job);
    }

    return ['job' => $job, 'failed' => true];
}

What happens is the failed() function never executes (or it simply halts script execution) and it prevents the next function, raisedFailedJobEvent() from being called. Now if I reverse the order of these lines, I can get the raiseFailedJobEvent() to fire and if I register a queue event handler in EventServiceProvider.php or AppServiceProvider.php, I can verify it gets fired and I can successfully handle the event. Unfortunately, having failed() before raiseFailedJobEvent() prevents this event from ever occurring. The hack I have in place is reversing the order of these methods, which works, but obviously that sucks.

The real problem seems to stem from how I make it fail. If I deliberately corrupt the data in the job queue table, the failed() method never gets called, but like I said before the raiseFailedJobEvent() function does get called if put it before the failed() method in Worker.php.

If I actually go into vendor/laravel/framework/src/Illuminate/Queue/Worker.php and force it to fail every time it runs (in an exception-less way), then failure() gets called. The problem, obviously, is how do I know how this queue will behave in a real-world failure? If corrupt db data causes a failure yet prevents failure() from being called, this is no good. I can never alert my team. What if there is an actual corruption of db queue data in the real world?

Jul
08
4 years ago
Activity icon

Replied to Queue::failing Laravel 5

I am using Laravel 5. 1 and I can never get this event to occur, either via Queue::failing inside the boot() method of AppServiceProvider.php, or EventServiceProvider.php, or even by calling the failed() method inside the actual job classes. This just doesn't work at all. Yet the job does get placed into the failed_jobs table so I know that part works. Has anyone else seen this behavior in Laravel 5.1?