Lars-Janssen

Member Since 5 Years Ago

Tilburg

Experience Points
154,715
Total
Experience

285 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
970
Lessons
Completed
Best Reply Awards
47
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.

  • Community Pillar

    Earned once your experience points ranks in the top 10 of all Laracasts users.

Level 31
154,715 XP
Apr
15
4 weeks ago
Activity icon

Replied to Gmail Is Changing <a Href"" To Wrong Link

Yeah I know that but still weird that eventually they redirect me to a subdomain on my own site.

Activity icon

Replied to Gmail Is Changing <a Href"" To Wrong Link

Thanks for helping, that url is correct! Very weird issue...

Apr
14
4 weeks ago
Activity icon

Started a new Conversation Gmail Is Changing <a Href"" To Wrong Link

Hi,

In Laravel I'm sending a plan html mail with an <a href="https://mydomain.com/movies"> tag. However when I open this mail in gmail and click on the link it's redirecting to:

http://email.mydomain.com/c/eJwVjktqxDAQRE9j7zSoP_p44UU2uUdLankcbM9gacj1o0BRFI-CqrKCBJj3dZFKGYepj0SILjl2LkUFSCVgnNi23732x6aX3tK1zM81hgAONEeq4gtgdYq8sGLO1jq087E-e3-3ib4m_B4qr60eH72yPvLrHKB90rn3ERwgsbA3BYgMc40mQgZTMkINmECXMGo1iWLJYjhENgykZgFCQ6HUQt6jJT_f6yF3-5GrNb08j-vbKfvxP_kHeflFfA

Why is google redirecting to a non existing mail subdomain on my site?

The mail html looks like this:

Schermafbeelding-2021-04-14-om-22-34-57

Any idea how I can fix this?

Thanks

Mar
23
1 month ago
Activity icon

Started a new Conversation Laravel Bug?

Hi,

When I manually mark a job failed like this:

 public function handle()
    {
        if ($timestamp = Cache::get($this->cacheKey)) {
            $this->release(
                $timestamp - time()
            );
        }

        try {
            $molliePayment = $this->pendingPayment->bill();
            $this->payment->setMolliePaymentId($molliePayment->id);
        } catch (ApiException $ex) {
            if ($ex->getCode() == 429) {
                $this->handleThrottle(
                    $ex->getResponse()->getHeader('retry-after')[0]
                );
            } else {
                $this->payment->update([
                    'error' => $ex->getMessage(),
                ]);

                $this->fail();
            }
        } catch (\Exception $ex) {
            $this->fail($ex);
        }

        return $this->payment;
    }

In my test:

/** @test */
    public function a_failed_payment_message_is_stored()
    {
        $order = Order::factory()->create();

        $payment = $order->payments()->create([
            'amount' => 5.00,
        ]);

        BillPaymentJob::dispatchNow($payment);

        $this->assertNotNull($payment->first()->error);
    }

I get this error message:

ErrorException : Undefined array key "job"

When I manually try this (with redis) it's working like expected. Why am I receiving this error in my tests?

Feb
26
2 months ago
Activity icon

Started a new Conversation Laravel & Shopify -> Setup

Hi,

I've got a shopify website under https://mydomain.com. Now I want to use laravel on a submap. https://mydomain.com/submap. How can I achieve this because I can't change the .htaccess file in shopify.

Any ideas?

Thanks

Feb
24
2 months ago
Activity icon

Started a new Conversation Subdomain Routing Not Working

Hi,

I've defined a sub domain route like this:

Route::domain('registreer.' . env('APP_DOMAIN'))->name('register.')->group(function () {
    Route::get('/', [DogNameController::class, 'index'])->name('name.show');
});

When I test this locally it's working. Also when I try:

php artisan route:list

On my staging server I see the correct route registreer.x.com. I've added a A record to my dns pointing to my server.

When I visit my subdomain it's redirected to my 'main' domain x.com.

What could be wrong here?

---EDIT

I'm using forge, this is my nginx file:

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/{{ SITE }}/before/*;

server {
    listen {{ PORT }};
    listen {{ PORT_V6 }};
    server_name {{ DOMAINS }};
    server_tokens off;
    root {{ PATH }};

    # FORGE SSL (DO NOT REMOVE!)
    # ssl_certificate;
    # ssl_certificate_key;

    ssl_protocols TLSv1.2 TLSv1.3;
  

    add_header X-Frame-Options "SAMEORIGIN";
    add_header X-XSS-Protection "1; mode=block";
    add_header X-Content-Type-Options "nosniff";

    index index.html index.htm index.php;

    charset utf-8;

    # FORGE CONFIG (DO NOT REMOVE!)
    include forge-conf/{{ SITE }}/server/*;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/{{ SITE }}-error.log error;

    error_page 404 /index.php;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass {{ PROXY_PASS }};
        fastcgi_index index.php;
        include fastcgi_params;
    }

    location ~ /\.(?!well-known).* {
        deny all;
    }
}

# FORGE CONFIG (DO NOT REMOVE!)
include forge-conf/{{ SITE }}/after/*;
Jan
19
3 months ago
Activity icon

Replied to Mock Artisan Command

Thanks great solution!

Jan
18
3 months ago
Activity icon

Replied to Mock Artisan Command

Thanks but that can't be the problem. A command extends Illuminate\Console\Command where the constructor is called.

Activity icon

Replied to Mock Artisan Command

Hmm still not working when I test it like this:

 /** @test */
    public function refund_payment_command_is_executed()
    {
        Carbon::setTestNow('05-05-2020 09:00');

        $instance = $this->partialMock(RefundPaymentsCommand::class, function ($mock) {
            $mock->shouldReceive('handle')->once();
        });

        $this->app->instance(RefundPaymentsCommand::class, $instance);

        Artisan::call('schedule:run');
    }
}

I get:

Symfony\Component\Console\Exception\LogicException : Command class "Mockery_0_App_Console_Commands_RefundPaymentsCommand" is not correctly initialized. You probably forgot to call the parent constructor.

Any ideas?

Jan
17
3 months ago
Activity icon

Started a new Conversation Mock Artisan Command

Hi,

I'm trying to test my scheduler is running correctly. My test looks like this:

 /** @test */
    public function refund_payment_command_is_executed()
    {
        Carbon::setTestNow('05-05-2020 09:00');

        $this->mock(RefundPaymentsCommand::class, function ($mock) {
            $mock->shouldReceive('handle')->once();
        });

        Artisan::call('schedule:run');
    }

But this is not working. I get an exception:

Mockery\Exception\BadMethodCallException : Received Mockery_0_App_Console_Commands_RefundPaymentsCommand::setLaravel(), but no expectations were specified

It looks like other methods are called before the handle method. How could I test this and mock the artisan command correctly?

Thanks for helping!

Jan
10
4 months ago
Activity icon

Started a new Conversation Laravel Job Testing

Hi,

I've got a test and I want to assert that 2 jobs are dispatched. However when I do this:

 /** @test */
    public function a_birthday_order_and_payment_is_created_if_within_x_days()
    {
        $this->withoutNotifications();

        $this->expectsJobs([
            CreateSubscriptionPaymentJob::class,
            CreateSubscriptionOrderJob::class,
        ]);

        $customer = User::factory()->create([
            'shopify_id' => Str::random(10),
        ]);

        $subscription = Subscription::factory()->create([
            'plan' => 'BIRTHDAY',
            'customer_id' => $customer->id,
        ]);

        $payment = Mollie::api()->payments()->get(\Tests\Mollie::PAID_FIRST_PAYMENT_WITH_WELCOME_BOX);

        event(new SubscriptionVerified($subscription, $payment));
    }

The jobs are not executed but they should. How can I make sure the jobs are executed?

Thanks

Dec
20
4 months ago
Activity icon

Started a new Conversation Check For Time Aswel

Hi,

I've got this method:

GiveAway::whereHas('brands')
                    ->whereDate('starts_at', '<=', Carbon::now())
                    ->whereDate('ends_at', '>=', Carbon::now())
                    ->get();

Right now it only checks for date. But It should check the time aswel. I know there is a ->whereTime function but this should be possible with 1 method right?

(I don't want to use ->whereBetween)

How can I make sure it checks for time aswel?