travoltron

travoltron

Member Since 3 Years Ago

Experience Points 4,980
Experience
Level
Lessons Completed 35
Lessons
Completed
Best Reply Awards 2
Best Answer
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.

06 Dec
11 months ago

travoltron left a reply on Having Doubts With The Laracasts Series Steps

There are two answers I always have to the "what should I make first" question.

First, make a blog. It's the tried and true method for learning most frameworks. Plus, you can blog about the things that you're learning, as you're learning them. For every person who asks these questions, there's easily a dozen others who are asking the same exact things in their heads.

Second, think to things you'd like to have, or something you think you could do better.

For instance, I hate that there's no really easy Knowledge base as a service thats not tied to a full help desk suite. I don't want to pay for all that, I just really need a FAQ section that's easily editable. That's something to make.

Or maybe you wish Twitter sorted things by character count rather than date. Make a Twitter clone that does that.

Those are obviously not great examples, but you get the idea.

Build on, builder!

31 Jul
1 year ago

travoltron left a reply on Is It Possible To Use Laravel Dusk Browser Outside Of Testing?

https://packagist.org/packages/travoltron/dusk-secure

I've gone ahead and ripped out all the route exposing user stuff to make a more viable Dusk-based scraper for us all.

23 Feb
1 year ago

travoltron left a reply on Phpunit - Build Failed Using CircleCI On Each Commit (supported Ciphers Related)

Make sure you set the APP_KEY as an environment variable in circle. Since your .env file is not included in the commit and it's the source of the key, your deployment is going to complain.

10 Jan
1 year ago

travoltron left a reply on How Do I Add An Input Value On The Fly Inside A Request Instance?

Anyone done anything like this in 5.3?

24 Nov
2 years ago

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun

Yeah, that's what it was, needed to run inside homestead. Closing this and hanging my head in shame....

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun

Yeah, its a homestead box, pretty typical installation.

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun

Yep. The typical redis-cli -> ping = PONG definitely in effect.

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun

public static function createBitfield($uuid)
{
        // Creating bitfield array for the user
        foreach(config('bitfields') as $bitfield) {
            $bitfields[$bitfield] = false;
        }
        Redis::set('bitfields_'.$uuid, json_encode($bitfields));
        return $bitfields;
}
23 Nov
2 years ago

travoltron started a new conversation Unit Testing And Redis: Enemies Of Fun

I'm testing a json api, and the methods for creating the test couldn't be easier, however, I'm running into a snag:

Part of the function that I'm testing calls another controller that stashes some data into a redis database, (it's part of a pestering campaign (like a drip campaign, but pushy)). When I use the app normally, everything is gravy, testing in Postman, still gravy.

However, when I start to test, I get some errors about Connection Refused.

Test code:

$faker = Faker::create();
$this->post('/create-user', [
     'email' => $faker->email,
     'password' => $faker->md5
])->seeJson(['uuid']);

And the response:

1) UserTest::testCreate
Unable to find JSON fragment [["uuid"]] within [{"error":{"fields":null,"general":"Connection refused [tcp:\/\/127.0.0.1:6379]"}}].
Failed asserting that false is true.

/if5/vendor/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php:261
/if5/vendor/laravel/framework/src/Illuminate/Foundation/Testing/CrawlerTrait.php:220
/if5/tests/UserTest.php:22

The method I'm testing:

$uuid = substr(sha1(microtime()), 0, 12);
$user = new User;
$user->email = Input::get('email');
$user->password = Input::get('password');
$user->uuid = $uuid;
$user->confirmation_token = md5(microtime());
if (!$user->save()) {
    return Response::error('Could not create new user.', $user->getErrors(), 400);
}
$bitfields = BitfieldController::createBitfield($uuid);

The last line is where I get Redis into the mix. How should I proceed with making this test?

Thanks!!

22 Oct
3 years ago

travoltron left a reply on Formatting Messagebag Errors

@bobbybouwmann, that works for when I know the fields I'm validating, but what about when it's something dynamic? I don't mind running an ajax request on keyup or something to test a field, so I'm totally ok with it failing 'required', resubmitting and failing again for 'min:10' or something.

I ended up doing this:

$fields = [];
foreach ($validation->getMessages() as $field => $value) {
    array_push($fields, [$field => $value[0]]);
}

Hope it helps anyone else in the same boat as myself.

travoltron left a reply on Formatting Messagebag Errors

To note: I'd like to keep this in `app/Http/Requests/Request.php if I can, that way the copy/pasta is cut down.

travoltron started a new conversation Formatting Messagebag Errors

Currently, I'm using validation to great effect, but I'm trying to simplify some API responses and not have to sort through arrays:

Example of what's being returned:

MessageBag {#349
  #messages: array:3 [
    "password" => array:1 [
      0 => "The password field is required."
    ]
    "email" => array:1 [
      0 => "The email field is required."
    ]
    "username" => array:1 [
      0 => "The username field is required."
    ]
  ]
  #format: ":message"
}

As you can see the keys are listed (GREAT), but the errors are nested in an array, (less great), how can I put those on the same level, a la

MessageBag {#349
  #messages: array:3 [
    "password" => "The password field is required.",
    "email" => "The email field is required.",
    "username" => "The username field is required.",
  ]
  #format: ":message"
}

Thanks!!

23 Jul
3 years ago

travoltron left a reply on Processing AJAX Requests From Vue.js

See above:

I also like to use the built in Response class so I can also add HTTP response codes:

post('api/reset_waitlist_v2',function(Request $request)
{
    $email = Request::all();
   return Response::json(array('email' => $email),200);
});

travoltron started a new conversation Adding Custom Schedule Methods

The scheduler function in L5 is pretty amazing, I think we can all agree on that.

I'm wondering what the best way to add things like weekends to the available schedule constraints:

Illuminate\Console\Scheduling\Event.php
public function weekdays()
{
    return $this->spliceIntoPosition(5, '1-5');
}

and its logical opposite:

public function weekends()
{
        return $this->days(array( '0','6'));
}

Where would I include these things so that they're not overwritten with a framework update?

13 Feb
3 years ago

travoltron left a reply on Class 'IronMQ' Not Found

I'm staying in L4.2 and seeing the same error on the same line. Is there something specific to 4.2 and "iron-io/iron_mq": "dev-master" I need to be aware of?