Bento

Bento

Member Since 4 Years Ago

Experience Points
4,095
Total
Experience

905 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
42
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
4,095 XP
Jan
13
1 month ago
Jan
12
1 month ago
Activity icon

Started a new Conversation Check If A Value From A Nested Array Exists In Another Nested Array

I have an array like this:

$mySeriesArr:

array (size=2)
  0 => 
    array (size=2)
      'id' => int 4
      'videos_id' => int 6
  1 => 
    array (size=2)
      'id' => int 3
      'videos_id' => int 22

I need to know if the value of 'videos_id' exists as the value 'id' in this array example.

$allSeriesArr:

  0 => 
    array (size=17)
      'id' => int 6
      'type' => int 0
      'title' => string 'Showname 1' (length=11)
  1 => 
    array (size=17)
      'id' => int 8
      'type' => int 0
      'title' => string 'Showname 2' (length=11)

I can do it with a SQL join but then (for other reasons) I cannot cache the result as it's different for each user. That's why I split it into 2 queries and want to compare them in code.

Anyway, I must be dumb but I cannot figure this out in a clean way (or at all).

Any ideas?

Oct
13
4 months ago
Activity icon

Replied to Scheduled Job Keeps Failing And Retrying But When Ran Manually It Works Fine?

So it looks like the job succeededs every 15 mins, then is somehow retried 2 mins later and then marked as failed. And then it keeps being retried.

Activity icon

Replied to Scheduled Job Keeps Failing And Retrying But When Ran Manually It Works Fine?

Ok so the weird thing is that I have it set to run every 15 mins. So I cleared Redis, truncated the failed_jobs, restarted Horizon and waited. The Job was executed successfully at 17:00. Then at 17:10 it tried again and failed with the same previous errors.

This is odd as it should only execute again at 17:15 right? I have also added the following to the Job but havent found anything other than the same error as before in the logs:

/**
 * The job failed to process.
 *
 * @param  Exception  $exception
 * @return void
 */
public function failed(Exception $exception)
{
    Log::error($exception);
}
Activity icon

Replied to Scheduled Job Keeps Failing And Retrying But When Ran Manually It Works Fine?

Logs have the same error:

[2019-10-13 16:42:23] SITENAME.ERROR: App\Jobs\GeneratePopularDownloadStats has been attempted too many times or run too long. The job may have previously timed out. {"exception":"[object] (Illuminate\Queue\MaxAttemptsExceededException(code: 0): App\Jobs\GeneratePopularDownloadStats has been attempted too many times or run too long. The job may have previously timed out. at /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Worker.php:612)
[stacktrace]
#0 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(426): Illuminate\Queue\Worker->maxAttemptsExceededException(Object(Illuminate\Queue\Jobs\RedisJob))
#1 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(338): Illuminate\Queue\Worker->markJobAsFailedIfAlreadyExceedsMaxAttempts('redis', Object(Illuminate\Queue\Jobs\RedisJob), 3)
#2 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(294): Illuminate\Queue\Worker->process('redis', Object(Illuminate\Queue\Jobs\RedisJob), Object(Illuminate\Queue\WorkerOptions))
#3 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(129): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\RedisJob), 'redis', Object(Illuminate\Queue\WorkerOptions))
#4 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(112): Illuminate\Queue\Worker->daemon('redis', 'default', Object(Illuminate\Queue\WorkerOptions))
#5 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(96): Illuminate\Queue\Console\WorkCommand->runWorker('redis', 'default')
#6 /home/vagrant/code/REMOVED/vendor/laravel/horizon/src/Console/WorkCommand.php(46): Illuminate\Queue\Console\WorkCommand->handle()
#7 [internal function]: Laravel\Horizon\Console\WorkCommand->handle()
#8 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array(Array, Array)
#9 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Support/helpers.php(522): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#10 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): value(Object(Closure))
#11 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#12 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Container/Container.php(591): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#13 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Console/Command.php(202): Illuminate\Container\Container->call(Array)
#14 /home/vagrant/code/REMOVED/vendor/symfony/console/Command/Command.php(255): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#15 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Console/Command.php(189): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#16 /home/vagrant/code/REMOVED/vendor/symfony/console/Application.php(934): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#17 /home/vagrant/code/REMOVED/vendor/symfony/console/Application.php(273): Symfony\Component\Console\Application->doRunCommand(Object(Laravel\Horizon\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#18 /home/vagrant/code/REMOVED/vendor/symfony/console/Application.php(149): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Console/Application.php(90): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /home/vagrant/code/REMOVED/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /home/vagrant/code/REMOVED/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 {main}
"}

I will look into the timout thing, but as the Job only runs for a few seconds and succeeds every time when called from a Controller it's probably not the issue. But who knows at this point :-)

Activity icon

Replied to Scheduled Job Keeps Failing And Retrying But When Ran Manually It Works Fine?

Hi,

Checked that, but even when I run artisan queue:work manually in my terminal it fails.

Activity icon

Started a new Conversation Scheduled Job Keeps Failing And Retrying But When Ran Manually It Works Fine?

Laravel 6.1, PHP 7.3.9

So I have created a Job to generate some stats every 15 mins. Tested it by putting it in a Controller and it works fine:

<?php

namespace App\Http\Controllers;

use App\Models\User;
use Illuminate\Support\Facades\Auth;
use App\Jobs\GeneratePopularDownloadStats;

class TestController extends Controller
{
    public function test()
    {
        GeneratePopularDownloadStats::dispatch();
    }
}

But when I try to run the Job as a scheduled task every 15 mins then it keeps failing and retrying forever. I have zero clue why this is happening. More info, logs & Job code can be found here:

https://kopy.io/m7lTf#ktrskKbwnWeFGo

So looking at that it looks like it works every X amount of times but between that it for some reason keeps failing and retrying.

The error I see in Telescope:

App\Jobs\GeneratePopularDownloadStats has been attempted too many times or run too long. The job may have previously timed out.

The job runs for maybe 10 seconds so it can't time out? All my other Scheduled commands, execs and one other Job run fine.

[EDIT] Stacktrace from Telescope: https://kopy.io/X7RoQ#ppEEXPodBRWsnO

Oct
07
4 months ago
Activity icon

Replied to ShouldQueue Throws Driver Not Supported

Ok so I had another error with Redis. It said i had to remove the Facade when switching to phpredis, when I did so it complained it couldnt find Redis....

php artisan config:cache did nothing so I rebooted the box and now everything works. Including the notification...

I have had these issues before. Is there anything else I need to do besides config:cache? Because that doesn't seem to work often.

Activity icon

Started a new Conversation ShouldQueue Throws Driver Not Supported

So this all worked fine when I build it in June, I recently upgraded to Laravel 6.0 from 5.8 and now this seems to have broken. I have already reinstalled the package using Composer and have now figured out everything works if the notification isn't queued.

The error: Driver [NotificationChannels\Pushover\PushoverChannel] not supported. is only thrown when ShouldQueue is implemented.

Any idea on how to fix this?

<?php

namespace App\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use NotificationChannels\Pushover\PushoverChannel;
use NotificationChannels\Pushover\PushoverMessage;

class PaymentCompleted extends Notification implements ShouldQueue
{
    use Queueable;

    protected $message;

    /**
     * Create a new notification instance.
     */
    public function __construct($message)
    {
        $this->message = $message;
    }

    /**
     * Get the notification's delivery channels.
     *
     * @param mixed $notifiable
     *
     * @return array
     */
    public function via($notifiable)
    {
        return ['mail', PushoverChannel::class];
    }

    /**
     * Get the Pushover representation of the notification.
     *
     * @param mixed $notifiable
     *
     * @return \NotificationChannels\Pushover\PushoverMessage
     */
    public function toPushover($notifiable)
    {
        return PushoverMessage::create($this->message)
            ->title('REMOVED Payments')
            ->sound('cashregister');
    }

    /**
     * Get the mail representation of the notification.
     *
     * @param mixed $notifiable
     *
     * @return \Illuminate\Notifications\Messages\MailMessage
     */
    public function toMail($notifiable)
    {
        return (new MailMessage())
            ->greeting('Hello!')
            ->line('Your payment has been successfully processed.')
            ->action('View account', 'https://REMOVED/profile')
            ->line('Thank you for usingREMOVED!');
    }
}