arvisto

arvisto

Member Since 1 Year Ago

Toronto

Full Stack Engineer at Inkbox

Experience Points 7,830
Experience Level 2

2,170 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 71
Lessons
Completed
Best Reply Awards 1
Best Reply
Awards
  • Start Your Engines Achievement

    Start Your Engines

    Earned once you have completed your first Laracasts lesson.

  • First Thousand Achievement

    First Thousand

    Earned once you have earned your first 1000 experience points.

  • One Year Member Achievement

    One Year Member

    Earned when you have been with Laracasts for 1 year.

  • Two Year Member Achievement

    Two Year Member

    Earned when you have been with Laracasts for 2 years.

  • Three Year Member Achievement

    Three Year Member

    Earned when you have been with Laracasts for 3 years.

  • Four Year Member Achievement

    Four Year Member

    Earned when you have been with Laracasts for 4 years.

  • Five Year Member Achievement

    Five Year Member

    Earned when you have been with Laracasts for 5 years.

  • School In Session Achievement

    School In Session

    Earned when at least one Laracasts series has been fully completed.

  • Welcome To The Community Achievement

    Welcome To The Community

    Earned after your first post on the Laracasts forum.

  • Full Time Learner Achievement

    Full Time Learner

    Earned once 100 Laracasts lessons have been completed.

  • Pay It Forward Achievement

    Pay It Forward

    Earned once you receive your first "Best Reply" award on the Laracasts forum.

  • Subscriber Achievement

    Subscriber

    Earned if you are a paying Laracasts subscriber.

  • Lifer Achievement

    Lifer

    Earned if you have a lifetime subscription to Laracasts.

  • Laracasts Evangelist Achievement

    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 Achievement

    Chatty Cathy

    Earned once you have achieved 500 forum replies.

  • Laracasts Veteran Achievement

    Laracasts Veteran

    Earned once your experience points passes 100,000.

  • Ten Thousand Strong Achievement

    Ten Thousand Strong

    Earned once your experience points hits 10,000.

  • Laracasts Master Achievement

    Laracasts Master

    Earned once 1000 Laracasts lessons have been completed.

  • Laracasts Tutor Achievement

    Laracasts Tutor

    Earned once your "Best Reply" award count is 100 or more.

  • Laracasts Sensei Achievement

    Laracasts Sensei

    Earned once your experience points passes 1 million.

  • Top 50 Achievement

    Top 50

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

14 Jan
2 months ago

arvisto left a reply on Validation Exception Status Code

I got it to work by passing in a response object to the ValidationException. Any other way seems to have no permanence, as the status code is overwritten somewhere down the line.

arvisto left a reply on Validation Exception Status Code

Alright I think I was no clear on what I needed to do and was likely doing more than I needed to.

I realized there was no need for this to be an Exception except in one case where it redirects back() with a custom message. So let that one stay as a validation exception.

The other case where I needed it to be a 301 I simply did the following inside of my failedValidaiton() function:

$this->redirector->to('another_url')->setStatusCode(301);

arvisto left a reply on Validation Exception Status Code

Right, I've encountered what you mentioned, and I've no idea why it won't get passed further.

Bump, in case someone here is familiar with what happens the exception is thrown and how it translates into a response object.

10 Jan
2 months ago

arvisto left a reply on Validation Exception Status Code

My test so far:

$product = factory(Product::class)->create([
            'key2' => $valueThatFails,
        ]);

        $response = $this->get("url");
        $response->assertRedirect("another_url");
        $response->assertStatus(301);

and that yields

1) Tests\Feature\MyClass::test_301
Expected status code 301 but received 302.
Failed asserting that false is true.

arvisto left a reply on Validation Exception Status Code

Hey Randy, Sadly it doesn't.

I also dabbled with creating a response object to initialize the ValidationException object, but I was not able to make it do what I wanted.

It seems as though something else catches it down the line and it uses the exception to make a response, but it ignores the status code coming in from the exception object.

arvisto started a new conversation Validation Exception Status Code

I have overridden the failedValidation() method of a custom FormRequest. I'm using it to check validation errors so I can handle redirection logic that I extracted from the controller. But I cannot get the status code I've set to persist down to the response returned

protected function failedValidation(Validator $validator) { /** * Default values */ $status = 302; $this->redirect = "some_url";

    if ($validator->errors()->has('key1')) {
        Session::flash('status_error', 'The product you are looking for doesn't exist.');
    } else if ($validator->errors()->has('key2')) {
        $status   = 301;
        $this->redirect = "another_url";
    } else if ($validator->errors()->has('key3')) {
        $this->redirect = "other_url";
    }

    try {
        parent::failedValidation($validator);
    } catch (ValidationException $exception) {
        $exception->status = $status;
        throw $exception;
    }
}

The response generated always seems to be a 302, even if I have told the ValidationException that its status is a 301.

Thanks in advance.

04 Dec
3 months ago

arvisto left a reply on Laravel Relations

I don't understand why it would make the API slow, as far as I know, you are correct relationships are not evaluated unless called. Maybe it would help to know how exactly they are calling it or why they believe the relationships would slow down the API.

arvisto left a reply on Laravel Relations

I'm not sure I understand fully some of the points you're making. So bear with me if I'm not accurate.

Why do you say that adding the relationship would add extra API calls? And how does it make it slower for mobile users?

From what I gather, your Timeline class contains descriptions for the the relations it could possibly have, however, a Timeline will only ever be one of three (User, Group, Page). So for any Timeline one relation will be relevant and the other two relations will return an empty array.

It looks like you COULD if you wanted to, separate this into three Timeline classes that extend the base timeline that way you avoid having code that is not relevant to all use cases for the base Timeline class.

02 Dec
3 months ago

arvisto left a reply on Extending Builder

Hey Talinon, thank you for taking the time.

Your arguments are very persuasive. In addition to what you just mentioned, while digging around I noticed also that the files in the databases\ directory are not name-spaced. Suggesting that this was perhaps not the place to add code.

I've gone and put it under App\Schema for now, now I wonder why Laravel didn't include the on_update and on_create defaults in their MySqlBuilder inside the Illuminate framework.

arvisto started a new conversation Extending Builder

I've extended builder to provide some default onUpdated and onCreated values to my migrations.

I'm wondering if this code should live in my App\ directory or should it live in the database\ directory?

This is very much a question of semantics. What is the philosophy behind these folders?

29 Nov
3 months ago

arvisto left a reply on Testing Commands That Die

Did it and it worked.

Thank you!

28 Nov
3 months ago

arvisto left a reply on Testing Commands That Die

Hey Nash, thank you for the reply.

That does sound like a way to go, however, one of the checks that calls die() currently happens in the __constructor() of my command, thus:

Can you fire an event from the constructor object of a command? Should I not be doing this check in the constructor and instead do it in.. say, setUp()?

27 Nov
3 months ago

arvisto started a new conversation Testing Commands That Die

I've a command that drops the database and restores the structure from a schema dump, then calls migrate. When I break my local db, I throw it away and create a brand spanking new one.

I added safeguards so that if you ever try to run it outside of local, it calls die() with a message telling you why.

My problem is I don't know how to test it. If I call it from within my tests, it will die and bring down the test suite with it.

Any suggestions? Fanks!