travoltron

Experience

3,630

2 Best Reply Awards

  • Member Since 2 Years Ago
  • 22 Lessons Completed
  • 0 Favorites

6th December, 2017

travoltron left a reply on Having Doubts With The Laracasts Series Steps • 5 days ago

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!

31st July, 2017

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

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.

23rd February, 2017

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

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.

10th January, 2017

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

Anyone done anything like this in 5.3?

24th November, 2015

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun • 2 years ago

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 • 2 years ago

Yeah, its a homestead box, pretty typical installation.

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun • 2 years ago

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

travoltron left a reply on Unit Testing And Redis: Enemies Of Fun • 2 years ago

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;
}

23rd November, 2015

travoltron started a new conversation Unit Testing And Redis: Enemies Of Fun • 2 years ago

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!!

22nd October, 2015

travoltron left a reply on Formatting Messagebag Errors • 2 years ago

@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 • 2 years ago

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 • 2 years ago

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!!

23rd July, 2015

travoltron left a reply on Processing AJAX Requests From Vue.js • 2 years ago

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 • 2 years ago

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?

13th February, 2015

travoltron left a reply on Class 'IronMQ' Not Found • 2 years ago

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?

Edit Your Profile
Update

Want to change your profile photo? We pull from gravatar.com.