Laracon Sessions with Jack McDade
June 06, 2017

"Laracon Sessions with Jack McDade" Full Transcript

This is the full transcript of the Laravel News podcast episode #39 - “Laracon Sessions with Jack McDade

Jacob Bennett: Hello everyone and welcome back to the Laravel News Podcast, [00:00:30] this is episode 39 and we have with us a very special guest Jack McDade on air with us today. Jack is going to be speaking with us at Laracon, and continuing in the tradition of the last couple shows here we have him on to talk about his development journey and what he's going to be talking about this year at Laracon. Jack, welcome to the show.

Jack McDade: Hi, thanks for having me. I feel special since you called me special.

Jacob Bennett: You are. You are a very special guest, and you are not really a stranger to the Laravel community either. You gave a talk last year at Laracon. [00:01:00] You've done a couple other things in the Laravel community as well. I think you've some some design work. What kind of stuff have you done?

Jack McDade: Yep. I designed, the current iteration, so my name is in the footer of that. I did the Envoyer site design. I did some stuff on the forge landing page. I think that one's been redesigned now. Yeah, just a lot of the community sites that are slowly change over time. I did Laracast and Jeffrey I think [00:01:30] had iterated out every pixel I designed pretty quickly, but you know, as he does. As is his prerogative, so it just keeps getting better which is all that matters.

So yeah, I've done a lot of design stuff in the community, but also built a CMS called Statamic which runs on Laravel, and we've begun extracting some packages out of that to give back to Laravel community so we're pretty involved on all the different angles and looking forward to speaking this year.

Jacob Bennett: Awesome. Very cool. Well that was a good kind [00:02:00] of brief introduction. For those of us in the Laravel community who might not be super familiar with you and where you're from, and where you work, what you do, could you give us a quick rundown on that too? Do you do Statamic full time, or is that kind of a side thing, or what's the deal with that?

Jack McDade: Yeah, I am first and foremost a fully grown human being, which is a pretty good achievement that I ...

Jacob Bennett: Nicely done. You made it.

Jack McDade: I'm really proud of it, and I've made it. I'm full adult from nine to five, and yeah. So basically, [00:02:30] my company is Wilderborn, which is the parent company for a lot of different things, but the biggest piece of that is Statamic. So we have, our team is three, we all work on it as much as we can, mostly full time at least for Jason and [Jaggie 00:02:46], but I've transitioned a little bit more into the product manager, business strategy, marketing side over the last year, and have my hands in a few other things from like consulting, or advisory mentor level.

[00:03:00] I've been working with [Ya's 00:03:02] Ninjaparade on his app ContestKit, and helping to bring that to the next level. So yeah, there's just a lot of things we do. My personal specialty tends to be on the UI, UX branding strategy side of things, thought I am Full Stack and I do build apps in Laravel, and can code PHP, and know the difference between a façade and all that stuff. So I try to wear all of [00:03:30] the hats, but really only are good at maybe two or three of them at any one time.

So these days it's more on the design thinking, strategy, business stuff.

Michael Dyrynda: Tell us a little bit, Jack, about your journey to development, how you ended up being someone that is, I guess, a jack of all trades by the sound of it.

Jack McDade: Yeah, never heard that one before. Yeah, so if you've ever seen the show Halt and Catch Fire, the guy who plays me [00:04:00] ... Okay, so, he's a baby. I'm a child of the 80s, so I grew up using my dad's laptops that he'd bring home from work. He was a federal government employee, he worked for the highway, and he'd bring home these 19 pound laptops.

Jacob Bennett: I still remember those.

Jack McDade: Four or five ...

Jacob Bennett: Yeah, those massive laptops.

Jack McDade: Oh my god, they were ... It was so exciting. Dinner would be over and he would be done doing whatever reason he had to bring it home that day for, and [00:04:30] it'd be sitting there on the kitchen table like glowing, and just asking for me like, "Push buttons." Like, I have no idea what's gonna happen, but it was like this magic box to this world that was way more interesting than the one I currently lived in. So I think it was probably video games at first, like Test Drive, or actually before that it would be like Space Invaders and stuff, whatever actually ran on this DOS, but I started tinkering around with Qbasics on the first laptop that actually stuck [00:05:00] around at home, right, and I think we all kind of made ...

I made choose your own adventure games, like typed adventure games, which was really kind of fun. I mean, the worst looping code ever ...

Michael Dyrynda: Right, conditionals, right? If, if, if, if ...

Jack McDade: Like go to ... Oh yeah.

Jacob Bennett: That definitely wouldn't fly now.

Jack McDade: Just endless, endless chains. Yeah. You know, the length of the game totally depended on how many conditions I felt like writing. There was nothing better. So you fast forward. I'm building stuff on Geocities, and Star Wars [00:05:30] fan sites when Phantom Menace came out 'cause I was really excited, and it turns out it was terrible. Keep fast forwarding, I built websites for uncles, and friend's dads and stuff while going through college, went to school for marketing.

It turns out marketing, especially in an academic sense, is really boring, and so as soon as I got that degree I stopped doing that and got a job coding. So [00:06:00] I was doing like a interactive marketing strategy slash front end developer position, which was really convenient 'cause I wasn't that good at front end dev yet at, I think it was like 2004, 2005, and my instant messenger screen name was like IKnowSomeHTML ...

Jacob Bennett: Nice.

Jack McDade: ... which everybody felt was a joke, like, "Haha it's funny. He only knows some," and I'm like, "No, literally. I know like some of the tags," right, and so you [00:06:30] go through the agency world. In a year you have to get really good or you're out. So I learned everything, and you know, you step stone to another company and a bigger position, and you build a web team and then quit your job and start a company and then build a product, and fast forward and here we are having this podcast episode.

Michael Dyrynda: Nice.

Jacob Bennett: Very cool, yeah. The beginning of your story sounds very similar to mine, Geocities and making small websites for family members and things like that, so that's interesting to hear. At which point [00:07:00] did you kind of transition from doing front end stuff to Laravel. What was the catalyst that pushed you to need to know the back end sort of things? When did you get started with the PHP?

Did you start with any other backend languages first, or start with something which was first, or was PHP your first shot at it?

Jack McDade: Yeah, it started with PHP when I was building stuff for ExpressionEngine, which is a content management system, not quite as popular as it used to be, and we were using it at the agency that I was at. And it [00:07:30] was missing some features, and the only way to add them was to write some PHP, and the other guys in the shop were like, "We only do .NET" I'm like, "Oh boy. I guess I'm doing this myself," or actually, no, it was ColdFusion.

Jacob Bennett: Oh gosh.

Jack McDade: [crosstalk 00:07:43] Can we do that in ColdFusion? No? Okay. So there starts like the reverse engineering, Googling the Stack Overflowing adventure of learning PHP backwards, like from the outside in, or inside out, whichever that would be. And then fast forward a little bit, and I was still kind [00:08:00] of leaned heavily on the front end and design side, but got into a large project where we were building this giant suite of SEO tools, and it was a Ruby app.

And I really liked a lot of the stuff that was happening in Ruby. This was pre Laravel 4, maybe 2008, 2009. I can't really remember exactly, but I hadn't heard of Laravel. It was either a twinkle in Taylor's eye, or something, and I loved the migrations. I loved the terse code. I loved [00:08:30] how it kind of did a lot of the hard work for you. So I started learning Ruby and Rails, and was building an app and kind of playing around with that.

And then I tried to launch my first Rails prototype app, and I don't know if you ever tried to stand up a Ruby server on your own. It's a nightmare, and I literally couldn't afford Heroku, and I was like Googling, "PHP framework with migrations," and that's literally how I found [00:09:00] Laravel. I think four had just come out, and I'm like, "Oh my god. This is it. I'm going back to PHP," after spending all nights and weekends going through Rails on Zombies, or for zombies, or whatever back in the day.

So yeah, that's how I found it and fell in love, and started using it more on other projects and tag teaming projects with it, and building my own stuff and working on other people's stuff, and yeah. It's been like heart eye emoji's ever since.

Michael Dyrynda: Nice.

Jacob Bennett: Nice. Hey, just Michael, I'm curious. I don't know if I've ever heard of how you [00:09:30] kind of discovered Laravel. For me it was through Jeffery Way. That was the way that I heard about it. I'm curious to know how you heard about it, if it was through Jeffery Way as well?

Michael Dyrynda: It was not through Jeffery Way.

Jacob Bennett: Okay.

Michael Dyrynda: I cannot for the life of me remember the exact circumstance. I know that I was still working for an internet provider at the time, and I think I was sort of just looking for a better way of doing what we were doing. So a lot of everything that I did there was, it was all hand rolled. Everything was built there.

We [00:10:00] didn't use anything external. We didn't use any packages or anything that we had found, and I think someone mentioned something to me about Symphony, and my eyes lit up when I saw that, and I thought, "Holy crap. I don't have to write all of this stuff by myself? I can just fix problems that we have instead of doing authentication, and handling sessions, and all of that stuff?" So I think somewhere along that line I sort of wound up stumbling onto Laravel.

And this was still in the three dot days where [00:10:30] there was the bundles and things like that, but I never really actually got around to using it until early version four.

Jacob Bennett: Very cool. And so that was bundles, that was before Composer was really a popular thing ...

Michael Dyrynda: Yeah.

Jacob Bennett: ... and now Laravel is hijacking the Composer files to do it's own stuff.

Michael Dyrynda: Yeah.

Jacob Bennett: The auto loading of the ...

Michael Dyrynda: App service providers.

Jacob Bennett: ... app service providers and things like that. Yeah, really cool stuff. So we might talk about that a little bit later in the show, but Jack, we wanted to ask you about, as well, what you're gonna be speaking [00:11:00] on this year at Laracon, and see if you could just give us a little bit of a preview of what topic you're gonna be covering.

Jack McDade: Yeah, so I think part of the fun of my talk last year is that it was highly ambiguous. I think my title was Wizards, Lawnmowers, and Hovercrafts, and like nobody knew what it was about, even Taylor. Taylor had had no idea. I think that was part of the intro, he's like, "I have no idea what this talk is about," comma, "Jack McDade," right? So to some degree I don't want to get too much into details, 'cause it's kind of part of the fun.

Jacob Bennett: Okay.

Jack McDade: However, [00:11:30] I definitely want to talk about ... Part of the high level concept is where we ... Well, before I get into that, I think I'm doing the only non-code talk. Last year I think there was a couple. The conference is a little bit shorter, I'm doing the, I think it's scheduled, at least right now, to be the last talk of the conference.

Michael Dyrynda: Wow, no pressure.

Jack McDade: So it's a little bit of ... Yeah, no pressure at all, Exactly. Make sure you remember lots of names, and thank everybody, but also, there's a little bit of like a sendoff and inspirational quality that should come [00:12:00] along with that, and one of the things I want to talk about is where we get satisfaction from in our job, and some deeper thoughts about that. It'll still be light-hearted, but there's this notion that I've been studying, and kind of experimenting, and doing some research about, where in today's society, in this highly interruptive culture of mass information, that we now as people, as fully grown human beings, or [00:12:30] slightly less than fully grown human beings, pass along data to other people that we now get this similar emotional feeling of satisfaction that our parents or previous generations from actually doing the thing the data was about.

So if we now send an article or retweet something about how to be more productive, we now actually feel like we're more productive, but we are literally no more productive than we ever were. And so that concept, I want to kind of unpack [00:13:00] that a little bit. And I've been doing some real life experimentation with different approaches to work over the last year in preparation, literally for this talk, which includes three or four different modes of work that I've tried and what works best, and yeah, it should be interesting.

It'll be interesting if nothing else.

Jacob Bennett: Yeah.

Michael Dyrynda: Yeah, I love the soft skills side of development. I think it's a lot more interesting, because we can get technical talks from so many different places, but for people to give talks on [00:13:30] soft skills, and to give them well ... And I was in your talk last year at Laracon and I loved it, and it really, it breaks up that conference as well.

If you're gonna be listening to tech talks all the time, primarily that is what the conference is for sure, but there's more to being a developer than writing code.

Jack McDade: Yeah, and to some degree a lot of the technical information that's laid out in a conference might even be more easily digestible in a blog form, or in like a screen cast form, because you can read it, and copy and paste it, and play with [00:14:00] it. So the conference really needs to lend itself to things that can make you think, or expose you to things that you would not have read the whole article to, right.

So that's the key, and so that's something I hopefully ... So good stories, a memorable topic, and good information, hopefully people can walk away with a nugget that can ...

Jacob Bennett: Very cool.

Jack McDade: ... improve the way they work.

Michael Dyrynda: I think the other thing that I had going against me last year was that I had trouble with specifically for the conference, and ...

Jacob Bennett: Yeah.

Michael Dyrynda: ... those of you that may not have guessed [00:14:30] from my accent, I am not from near, I am definitely not from near Laravel, and so it was a long journey there. You know, you've gotta make the most of the conference while you're there, so you're up late. You're spending time with people. You're hanging out. You're having a great time, and then to sit down and listen to technical talks all day, your brain is just absolutely fried.

So to try and absorb all of that information, I really really enjoyed Sandy Metz's talk and I had to watch it again as soon as the video was available, because [00:15:00] by the end of that first day I was melting off my seat. My brain was just gone.

Jacob Bennett: Yeah, as well as the mate you brought along with you.

Jack McDade: Yeah, and I think there's a lot of people ...

Jacob Bennett: Go ahead jack. Go ahead.

Michael Dyrynda: He was pickled.

Jack McDade: Yeah, I think that's just true of a lot of it, and I knew I was striking a chord last year when I started my talk and I could see probably about 3 or 400 shining apples, like they were just glowing out in the night, and about five minutes in there was like three, and I was like, "Oh, [00:15:30] they're listening."

That's a good feeling as a speaker when you see the Apple logos go out.

Jacob Bennett: Yeah, it was a very entertaining talk. I still remember, it was about, you know, you talked about Radio Shack and your boss there. It was a great story.

Jack McDade: Yeah.

Michael Dyrynda: It was may or may not have been Radio Shack, and it may or may not have [inaudible 00:15:49] the story.

Jack McDade: May, yeah. Who knows? We'll never know.

Jacob Bennett: Yeah, I love that it's very true, right, people remember best when you tell stories, right?

Jack McDade: Yeah.

Jacob Bennett: It's just how ...

Jack McDade: Exactly.

Jacob Bennett: ... our brains are wired, to remember stories. So I mean I could probably [00:16:00] give you the topic of a lot of the talks from last year, the topic, the main heading, but I could probably quote a lot of the story back to you that you told. So it's just interesting, too, how that works. So I'm sure you'll bring another couple good stories for us this year that we can remember.

Jack McDade: I hope so.

Jacob Bennett: Yeah, so I actually, I guess the one other question I was going to ask you was about this Twitter hiatus that you've kind of taken, and I remember a couple of months ago you had said like, "Hey, I'm back. Did anybody miss me," and it was like, "Oh, Jack. Hey, how's it going man?"

Jack McDade: "I didn't know [00:16:30] you were gone."

Jacob Bennett: So you had kind of taken a break there. Yeah. "Did anybody notice that I was not here? Guys come on." Yeah, so I'm assuming that's kind of part of what you were talking about with experimenting with different sort of work styles over the last year or so, so I don't want to spoil anything for you. I was gonna talk to you a little bit about the book that I've read recently that I know you had read that's called Deep Work, and it kinda talks about a lot of these similar things right, like we're in a highly distracted culture, and how do you kind of pull back on that [00:17:00] and really accomplish deep work?

Like, the idea being that, the ability to do deep work is becoming more and more valuable, a very valuable commodity in our society, and less and less people are able ...

Jack McDade: Exactly.

Jacob Bennett: ... to do it because they're so distracted.

Jack McDade: Mm-hmm (affirmative). I'm happy to talk about ... I think this is a highly fascinating topic, and there's only going to be some crossover with people people who are going to be at my talk in a few months so who cares?

Jacob Bennett: Yeah, absolutely. So what I was going to say about that Deep Work book though, it'll be interesting. So I got about three quarters of the way [00:17:30] through the book, and then I lost it during our move, so I don't know where it's at. So I was really disappointed, and I haven't found it and I haven't picked up another copy yet, so ...

Jack McDade: I'll send you screen shots of the rest of the pages.

Jacob Bennett: Perfect. There we go.

Jack McDade: Just like the way Adam does [inaudible 00:17:45] requests.

Jacob Bennett: Exactly. It'll be good to hear somebody who's actually finished the book, and then be able to implement some of the ideas. That'll be pretty cool. Let me ask you this. I know I'm sure that like, over your research you've read a lot [00:18:00] of different books. Do you have, and this is really pretty probably off the topic, but do you have any specific way that you like to read books that you have found has given you the best ability to recall the information, or is there a way that you summarize books, or does it help you to write a blog post after you read a chapter?

What are the ways that you get the most out of the books that you're reading?

Jack McDade: Yeah, so what works for me, what I've found is, I read my books on my iPad Pro, my giant iPad with the Apple Pencil, and I highlight everything that [00:18:30] stands out to me, and I use iBooks. So iBooks will roll up all of the things you've highlighted and give you thumbnail index to them, and so any time I'm thinking about something I read I can jump right back in, 'cause if I remembered it it was probably something I highlighted, and then I can kind of frame that, where in the chapter it was.

I don't do that when I'm reading, like fiction. I use a paper, or the iPad mini, but the Pro when I'm reading business books or things about improvement, or productivity, or [00:19:00] whatever, that seems to be the best way for me to retain the information.

Jacob Bennett: Very cool. Yeah, I was reading a article that was talking about how to become, I can't remember what the name of ours is, like how to become a hyper learner or whatever, and they were saying the two ways to gain knowledge is experience or by reading. It said reading is like downloading the brain of the author. And basically the way that they had recommended was the exact same, just non-digital. So he'd take hard copy books and he would highlight them, and then as he would finish the book he would go through and he [00:19:30] would, with his phone, take pictures of the pages that he had highlights on, and push those into Evernote.

And Evernote would OCR those, and then he would have a folder for each book, and then he could go back and kind of reference his highlights.

Jack McDade: Yeah, I have the automatic version of that.

Jacob Bennett: Yeah, exactly. Seems like a much more efficient way to do that. So I think I might actually do that, and some of the books that I have ... So like, it's hard, not all technical books come in iBook format, or do they? Have you found that they do? Like practical object oriented [00:20:00] design in Ruby is Sandy Metz's book.

Jack McDade: Yeah I didn't read that.

Jacob Bennett: Is that ...

Jack McDade: I don't know. I didn't read it.

Jacob Bennett: ... out on iBooks?

Jack McDade: Sorry.

Jacob Bennett: Okay. Yeah, that's why I'm saying, for some of these more technical books, they're not always available in Kindle format, or iBook, or something like that.

Jack McDade: I mean, if they can give you the PDF or the ePUB, I mean, you can import that into iBooks.

Jacob Bennett: Okay.

Jack McDade: And then you can still highlight it.

Jacob Bennett: Okay, very cool.

Jack McDade: Yeah. Try it.

Jacob Bennett: Awesome. All right. I might have to try that out.

Jack McDade: I mean, if you have the iPod Pro already ...

Jacob Bennett: [crosstalk 00:20:30] I will.

Jack McDade: ... just [00:20:30] try it. You don't have to spend $800 just to try something.

Jacob Bennett: I do not have the iPad Pro already. I'm gonna have to convince my wife that this is the next thing I need. In order to advance my career this is the next tool that I need to buy is a iPad Pro. It's necessary [crosstalk 00:20:46].

Jack McDade: It's made me more effective than, more productive than ...

Jacob Bennett: Yes, absolutely.

Jack McDade: ... anything else I've spent money on in the last couple years. It's like, you could quote me.

Michael Dyrynda: I think it would work for Jack as well because he can actually draw so.

Jack McDade: No, no I can't. I literally can't draw to save my life.

Michael Dyrynda: [00:21:00] I meant Jake, not Jack. Did I say Jack, Jack or Jake?

Jack McDade: Oh, I heard Jack. Yeah, sorry.

Michael Dyrynda: I'm sorry. It is very early for me.

Jack McDade: So there you go, it'll be even better for you Jake.

Michael Dyrynda: Jacob.

Jacob Bennett: There we go. There we go. Awesome. Michael, do you have any other questions for Jack before we let him go?

Michael Dyrynda: Only the ones that we will ask on Twitter.

Jacob Bennett: Yeah, why don't you go ahead and list all those out for us.

Michael Dyrynda: And I know that Jack got in, he saw these questions and he answered them on Twitter, but for the benefit of the people that were not following along [00:21:30] we did have one sort of technical question, and that was, "What was the hardest part of porting Statamic to Laravel," 'cause it was not originally on .. Was it Expression, or is it [inaudible 00:21:41] or something that was before?

Jack McDade: It was on Slim.

Michael Dyrynda: On Slim?

Jack McDade: Yeah, so technically it was two Slim applications. We had one for the front end and then one for the admin, and two different instances of Slim. And all of it was written in, literally all of it was written in the route's files. All of the methods [00:22:00] were all in the giant routes file, and it was, V1 was like a prototype MVP that kept getting more bubble gum until it actually worked really, really well. Like, "Can you add a feature," like, "No." It might all break.

Jacob Bennett: This thing is feature complete.

Jack McDade: Yeah, it's done. It's reached maximum potential. The most difficult thing really was re-writing it from the ground up, which is a lot of work. However, a lot of the decisions were already made. So [00:22:30] the more technical things that were a challenge were, basically we wanted to use Laravel's caching system so that we could have a lot of the built in drivers available to us and that kind of thing. So that was a fair amount of work to kind of reconcile with as much backwards compatibility as possible, the two caching systems. Which thankfully, you blow away the cache and it rebuilds itself, so backwards compatibility wasn't that much of an issue.

Also the user off driver for files was not [00:23:00] really easy since there's no database. We have, like every feature, a full database driven CMS wouldn't expect to have, except we use files to store it, and so that was hard. We tried to make an eloquent driver. That wasn't possible. Turns out it couldn't be done. So we basically just wrote all of our base classes in a eloquent style syntax, and we just basically had to recreate all of the same sort of chained methods and stuff. [00:23:30] So that was also pretty hard.

Jacob Bennett: Wow, yeah.

Jack McDade: I'm trying to think of anything else. Yeah, it was a lot of work. It took twice as long as we expected, which is better than the four times, as long as they say it usually takes when you re-write an app, but still, it was a lot of work.

Michael Dyrynda: Yeah, but now that you're on Laravel and you're using the OTS version for the base of Statamic. Is the plan to move to 5.5 when that comes out? Are there no firm plans? It's just whatever you feel like using at the time?

Jack McDade: Yeah, we're on the OTS [00:24:00] running 5.1, which made a lot of sense, plus it has a PHP 5.1 requirement, so if we just kind arbitrarily upgraded from, we're on 2.5 something but we're working on 2.6 right now, if we were to just upgrade to the newer version of Laravel it would just break stuff all over the place. And anyone running 5.5, there's just probably not a lot of people, but would mean they'd have to migrate servers, so we'll do that with V3, which we're hoping to put out later this year, and [00:24:30] yeah we're hoping to put it on 5.5 so we get the LTS which is great for people who are worried about, like, "Well what if my site needs to stay online for five years. We need a security patch in the future."

So that makes a lot of sense considering you don't ... You consume Laravel, but you're not starting a Laravel app with Statamic. It re-uses Laravel and it's built on top, and then you get to extend it with add-ons, but it's not like a Laravel app that you just start hacking away on. So it makes sense.

Michael Dyrynda: [00:25:00] Yeah. Well keeping that low baseline for install is, yeah, it makes it easier for the kind of people, I think, that would potentially be using that solution, but yeah going 5.5, obviously mindful of the fact that you're going from that 5.5 baseline to 7 as well, so.

Jack McDade: Right, exactly, which at this point with the newest versions of Ubuntu, 7.0 is the standard, which is great. We all benefit from that, so I don't think it should be a problem.

Michael Dyrynda: Yeah. The other question that we had was from our very [00:25:30] own Eric Barnes, and this is another one I believe you answered as well. It was a two part question, Gremlins or ET?

Jack McDade: Oh, ET for sure.

Michael Dyrynda: And Footloose or Dirty Dancing?

Jack McDade: Footloose. Who doesn't love Kevin Bacon dancing his heart out.

Jacob Bennett: Footloose, absolutely.

Michael Dyrynda: Yeah.

Jack McDade: You know, you could dance with a woman and you could hold her over your head and everything, but when you are alone with your feelings in a giant warehouse with pure white sneakers, that's a special moment.

Michael Dyrynda: [00:26:00] Yeah. Maybe that's where Taylor [inaudible 00:26:03]

Jacob Bennett: And apparently a parallel bar, or whatever that was, remember he was flipping around on that stupid thing or whatever?

Jack McDade: Yeah.

Jacob Bennett: Wasn't it? Or was it like rings or something? I don't remember. Something in the warehouse.

Jack McDade: I think it was rings. I'll be honest, I haven't seen the movie in like a decade, but I think it was maybe both. I think they definitely just cut in with like an amateur olympian gymnast to just do some sweet moves.

Michael Dyrynda: Yeah.

Jack McDade: Some flair kicks.

Jacob Bennett: [00:26:30] Which, just as a shout out, I love that rage dancing. That's so funny to me. If you guys have never seen the movie Hot Rod, you need to watch that. They have an amazing scene where it's, oh what's his name? He's from SNL.

Jack McDade: Andy Samberg?

Jacob Bennett: Yeah, that's right, Andy Samberg. Yeah, he has a awesome scene where he's like rage dancing in the woods. It's pretty hilarious.

Michael Dyrynda: We'll have to see if we can link that up in the show notes.

Jacob Bennett: We'll have to link that up in the show notes.

Jack McDade: Yeah, that will be really important ...

Jacob Bennett: Yes, please. That's awesome.

Jack McDade: ... for Andy's SEO quality right there, [00:27:00] yeah.

Jacob Bennett: Oh, please include this in your talk. You can include it in your talk. Just a little cut of it.

Jack McDade: The rage dancing?

Michael Dyrynda: Or yeah, right no we are asking Jack to include rage dancing in his talk this year.

Jack McDade: Or, I re-create the scene from footloose.

Jacob Bennett: I think that's a great idea. Let's do it.

Jack McDade: Yes.

Jacob Bennett: That would be amazing.

Jack McDade: I'll have to start practicing now.

Michael Dyrynda: Yeah.

Jacob Bennett: Yes. Yeah, you need to get a dance coach, and then next thing you know you'll be on Dancing With the Stars and we'll all be cheering for Jack.

Michael Dyrynda: Awesome.

Jacob Bennett: Good days, good days. [00:27:30] All right Jack, well thank you so much for coming on, and look forward to hearing your talk at Laracon this year. We will see you ...

Jack McDade: Yeah, thanks for having me.

Jacob Bennett: ... in [inaudible 00:27:37] city.

Michael Dyrynda: Cheers.

Jack McDade: Cheers.

Jacob Bennett: Absolutely.

Well, you may notice a slight change in my microphone. It may sound a little bit less good, a little bit of the bass is gone out of there, and the reason is that I am actually recording from the hospital. So we had our fourth child two days ago? Let's see, Saturday? So it is Monday, yeah. So [00:28:00] two days ago.

Michael Dyrynda: Yeah.

Jacob Bennett: He's doing really well, and we had a couple other things to talk about, so we wanted to make sure we go those things to you guys. So, committed to the Laravel community, that's me.

Michael Dyrynda: Yes you are. Yes you are.

Jacob Bennett: Plus, this is some really fun stuff to talk about. We got some cool things to talk about with you guys. 5.4.24 just came out this last week, and so we wanted to run down a couple of the things that were in the changelog, and the first thing we're going to talk about is gate resources. [00:28:30] So Michael, could you talk a little bit about what a gate is real quickly, and then how a resource is different that what it's been in the previous iterations?

Michael Dyrynda: Yeah, so gates basically allow you to define a list of policies that will prevent different users, or it won't prevent them, but it will check whether different users of your application have access to different things. So it basically allows you to call, I think, the user can ... There's a few different ways to [00:29:00] invoke the check, but basically you can define things like, "Client can view this page," or, "Client can view this specific, or user rather, can view this specific client, or update them, or delete them," or that the user that is able to create new clients in your application.

So previously you would have to define a specific ability for each one of these things, but with 5.4.24, the gate façade now has a resource method which [00:29:30] allows you to, in a similar way to how you would use resource controllers, basically define the client and then that would then allow you to the rest of the abilities, so whether it's view, create, update, delete, automatically registered as policies in your application.

Jacob Bennett: So I believe the way that you can do that is you make a gate class, right? Something like that? But then you have to register them similar to like how you do in your routes file, right? So you may have a user controller, but then the way that you access that is by [00:30:00] setting up your user routes in your routes, right? So you have route resource ...

Michael Dyrynda: Yeah.

Jacob Bennett: ... and then users, right, and it just automatically knows that you're going to have a class out there with an index, with a show, with a create, with an update and edit, an a delete, and so that's kind of what this does too right, is it says, "Hey, I have a gate class out here. I'm defining some abilities for editing users," or whatever, editing posts, and you can expect that there's going to be these classes out here.

So instead of having to register a new gate for every single one of those, just gate resource.

Michael Dyrynda: Yeah, so instead of having client [00:30:30] policy, view client policy, create, and so on, in the same way that you would have client controller, view client controller, create, all you would have to do is go, you know, "Gate, colon, colon, resource resource client, comma, client policy," and the four methods would be inferred, or the four gate checks would be inferred from that.

So you would get client view, client create, client update, and client delete.

Jacob Bennett: Very cool, yeah. And I actually just for the very first time in the last week and a half or so, [00:31:00] have used these, these gates. Previously there was some kind of architecture decisions that limited our ability to use these in our Laravel apps, but in the recent version of an application we're building we decided to try them out, and they are pretty incredible. They work really well, and it's nice that it, a lot of ...

Michael Dyrynda: Yeah, the certainly make things easier.

Jacob Bennett: Oh yeah, for sure, and it injects automatically the authenticated user into these kind of gate checks, which is great, because a lot of times in the stuff that I was doing I was having say, "Okay, grabbed the logged in user and then check to see what their role is, and then check to see if they have this ability," and this just [00:31:30] automatically grabs the logged in user, throws them into that gate check, and then you can do the check straight from there. So pretty cool, yeah.

Michael Dyrynda: Yeah.

Jacob Bennett: There was also two changes that me and Michael had a really fun time talking about, and I'm trying to make it as clear as I can here. There is two new methods. One is on the route. I don't know how I want to say this. One is a new method on ...

Michael Dyrynda: Route class.

Jacob Bennett: ... new route class, thank you, and the other one is a new method on the request class. So on the route class you have a new method [00:32:00] called "is name." So what this will do is, if you use the route class and you say, "is name," you can then pass in as a parameter the name that you're looking for and it will return a Boolean. I'm trying to think of a great example of where you would use this. I'm not exactly sure where that might be ...

Michael Dyrynda: Usually in like ...

Jacob Bennett: ... maybe in the middle ware or something like that?

Michael Dyrynda: No, I would use it in like, a navigation bar to determine whether or not we should apply an active state to a particular menu bar item. So you could use, [00:32:30] on any given page, "if route is 'users,' then add the active class to the users menu item."

Jacob Bennett: Very cool. A lot of times I have a problem with that when I have a drop down menu. So I might have ... I'll have 'claims,' then I'll have, there may be a spot where you click a button for 'create claim,' and there may be one where you have 'edit claim,' or something like that, and in any case I want that top level one to be highlighted whenever I am on any of those routes, those named routes. Do you know what I'm saying? So like, whenever [00:33:00] the ...

Michael Dyrynda: Yeah, I'm pretty sure that this supports using wildcards, so you could have claims dot star.

Jacob Bennett: Oh very cool, yeah. So that's where you would use it folks.

Michael Dyrynda: Yeah, I'm reasonably sure that works.

Jacob Bennett: So, route 'is name,' and then you have 'request route is.' So this is available through the request façade, or through the request global helper, so you could say 'request route is,' and it returns the same sort of Boolean check for you. So you just pass in whatever you would think the named route would be, and it would return a Boolean [00:33:30] check for you after checking it against the router.

So there you go, yeah.

Michael Dyrynda: Yeah.

Jacob Bennett: And I've actually had a couple spots where there were times that I wanted to check specifically, I think in the middleware ... In any case I know I've had to do this kind of manually in the past, and so this would be a good addition, good to know about.

Michael Dyrynda: Yeah, it makes it easier, not violating any laws of [inaudible 00:33:54].

Jacob Bennett: [inaudible 00:33:54]

Michael Dyrynda: [inaudible 00:33:54] However you pronounce it.

Jacob Bennett: There you go. I would give the example that Adam gave when we were talking about [00:34:00] this one other time, but then we would have to put the explicit tag on the show, so we'll leave that out.

Michael Dyrynda: Yeah.

Jacob Bennett: We also had an addition of a method called hash to the illuminate file system. So a lot of us end up using the storage façade and using fly system, but under the sheets Laravel does have it's own thing called 'file system,' that's still available. I think that you can get to it with the file façade, just file colon, colon, and they added a new method to it called [00:34:30] 'hash,' which, if you've ever had to do checks of two files against each other, so maybe ... I know Michael, you at work had kind of had this problem before right, where you were checking to see, has a user uploaded this file already?

And so, you can do an MD5 hash on that file, and then you can compare the hashes of those two files and it will tell you if they are in fact the same file. You had given me kind of a warning ...

Michael Dyrynda: Yeah.

Jacob Bennett: ... before we ... What was that, the one warning you wanted to give before?

Michael Dyrynda: Yeah, just to be mindful of [00:35:00] where you're using this method, because it's computing the MD5 hash of an actual file, so not of the file name itself, it can be quite computationally expensive. So it would, if you've got a large file, it will actually take a long time to generate the hash before you get a response, so probably not something you want to do for a large file if you've got a user accessing the page. You don't want the browser to appear to hang.

So if you need to generate the hash you'd probably want to do that [00:35:30] in a background process or some kind of call back out to the server as a AJAX request or something like that.

Jacob Bennett: Perfect, good advice. Thank you. Yeah, you've dealt with a lot of large files like that, so I know you've run into problems like this before so it's good to have the perspective on that.

Michael Dyrynda: Mm-hmm (affirmative), yeah.

Jacob Bennett: Maybe you could talk a little bit about the model refresh method that was added in?

Michael Dyrynda: Yeah, so with Eloquent you've got the ability, when you make an update or something like that in your application, you would potentially call the fresh method. [00:36:00] So what that would do is, you would have to go [inaudible 00:36:02] user, make your updates, and then if you needed to then pass the updated model back you would 'call user fresh' on that model, or you would 'call fresh' on that user model rather, and then what that will do is that would go back to the database and basically rehydrate the model from what you've got in the database.

So we all know how much we hate temporary variables for better or worse, so now what you can do is 'call user refresh,' [00:36:30] and it will update the model in place without having to assign it to a temporary variable.

Jacob Bennett: Interesting, because when you call the update method, what it does is it will just return a Boolean, right? It doesn't actually return back the model, right?

Michael Dyrynda: Yeah.

Jacob Bennett: It doesn't actually return back the values ...

Michael Dyrynda: Correct.

Jacob Bennett: ... of the model post being updated. It just returns true or false.

Michael Dyrynda: Mm-hmm (affirmative).

Jacob Bennett: Yeah, okay, Interesting. I wasn't exactly sure how this one worked, so that helps a lot.

Michael Dyrynda: Yeah, well the other good thing with the refresh method is that it's going to reload all of the relationships that you've already got loaded automatically.

Jacob Bennett: Nice. [00:37:00] Very cool. There is also, I think along those lines, I think Daniel Colbourne and [inaudible 00:37:06] had kind of pushed this model refresh through. [inaudible 00:37:09] also had another one called 'string after.' There was a 'string after' method that was added as a global helper, and really what this does is it allows you to take a known string, and then look for a pattern in that string, and then return everything after that pattern.

So for example, if I was looking through a bunch of different strings, maybe I'm mapping [00:37:30] over a collection and grabbing them out of some survey database and it says, "The user's name is colon, space, Jacob Bennet," I could say, "String after," I could pass it that string, and then I could say, "User's name is colon space," and then it would return me everything after that. So it would be a convenient way for me to just grab the Jacob Bennet portion of that without having to write my own logic for grabbing it out of that string, or separating on some sort of space, or whatever.

So it's a handy little method that was added in, and I think I'll probably use that in the [00:38:00] future as well.

Michael Dyrynda: Yeah.

Jacob Bennett: There was also a couple things added with ... It's really sort of a convenient helper method, and it's called API resource. Can you tell us about that Michael?

Michael Dyrynda: Yeah, so the theory behind the merge request was that for those of you who are using route resources, it gives you the full index, create, read, update, edit, and delete methods routes defined for you, and then you just have to go and either manually create your resource controller, or [00:38:30] use the 'make controller artisan' command, that with this new method that's been added is called API resource, it will create you a set of endpoints that omit the create and edit routes.

This will create you the index, show, store, update, and destroy methods, so no create or edit.

Jacob Bennett: Yeah.

Michael Dyrynda: So you may allow users to update an existing resource and destroy an existing resource, but in terms [00:39:00] of, you know, there are no edit and there are no ...

Jacob Bennett: Create.

Michael Dyrynda: ... yeah, and so there's no edit view ...

Jacob Bennett: There's no edit. There's no create, yeah.

Michael Dyrynda: And there's no create view. Yeah, you would just post to store, or you would post directly to update.

Jacob Bennett: Mm-hmm (affirmative), edit. Okay, yep, that makes sense right, 'cause there is gonna be no form for creating it.

Michael Dyrynda: There's no view, yeah ...

Jacob Bennett: There's no view.

Michael Dyrynda: ... in your API.

Jacob Bennett: Yeah, totally makes sense. I got it. Yeah, I find myself ... If you didn't know about this this is also helpful as well. When you're creating a route resource you can also pass in as one of the parameters, you can say, "accept," [00:39:30] or, "only," and then you can send in which routes you want to omit or which ones you want to create when you're doing a route resource.

So sometimes with route resource I'll want to make sure that they don't have the ability ... So like, on some of them, I can't remember, there's this one that I only wanted them to be able to create it. Once it's created you can't edit it, so there was no edit, no update, and no destroy. So you would just say, "Route resource," and then you give the name, give the controller, and then as the third parameter I think you pass in an array and you can say, "accept," [00:40:00] and then you can pass in edit, update, destroy, and it will create the route resource except those three routes for you.

And you can do the inverse of that using 'only,' So this is basically just a little helper for you. So you just call route, colon, colon, API resource, and it will do that without the create and the edit. Very cool.

Michael Dyrynda: Yeah.

Jacob Bennett: Maybe you can talk a little to us about custom validators as well well Michael. This was a pretty cool addition here, Taylor put out a post about this this last week as well.

Michael Dyrynda: Yeah, so [00:40:30] currently what you would need to do if you wanted to come up with your own validation rule is to use the validator extend method, so in your service provider or in a custom validation service provider you would call validate, colon, colon, extend, give it a name, accept some input, and then return as I think the third parameter a call back on how you would operate on that in order to determine if that input was valid, which [00:41:00] got a bit unwieldy having to define all of those things ...

Jacob Bennett: Yeah, even just having to say it.

Michael Dyrynda: ... in your app service provider. Yeah, so in Laravel 5.5 there's a new feature coming which allows you to have custom validation rules defined as classes, so basically this is just extending from, I'm sorry, implementing a rule contract, a rule interface in your application, and then that will accept your inputs in the constructor, and then there is two methods. There is a 'passes' [00:41:30] method, which is what you use to determine whether or not the validation should pass based on the inputs, and of the incoming attribute and the value, and then also a message that should be returned in the even that the validation does not pass.

Jacob Bennett: Yeah, so it really makes it quite easy. Before it really was ... It didn't feel good. It didn't feel good, and with this you really can just use the same sort of validation techniques that you used, where I know in my controllers I'll have like, "This validate," and [00:42:00] then I will say maybe, "User name required," and then you can pass, comma, and then you just do exactly what you'd do to new up a new class, except that you're newwing up your validation class. All it has to do is implement that rule, and then have two methods, passes and message, and then you can pass in whatever you want into your constructor.

So if you need a couple extra pieces of information, so in the example that's given they need a specific provider, so they need to know which provider it is that they're trying to compare this again. Is it Github? Is it Bitbucket? Is it [00:42:30] Gitlabs? Which one is it? And then depending on which one that is, is you're obviously gonna have a different way that you validate that it's a valid resource or whatever it might be. So it gives you the ability to pass in whatever you need into the constructor, and then the passes method that will get called when it goes to do the validation gets both of the attribute, so what's the name, in this case it would have been user name, and then whatever the value is of that user name thing that's coming through in the request.

Michael Dyrynda: Yeah.

Jacob Bennett: So this was really a pain [00:43:00] in the past, and they've made it extremely easy. So go check it out on Laravel News, or Taylor's post out there as well. We also had, if you've been around since the Laravel four, it used to be that there was a package called Whoops that was installed by default with Laravel four, and what it is is it catches your exceptions and it displays them to you graphically, really, really nicely.

And I know this was something that was [00:43:30] kind of mourned as a large loss when Laravel, I'm trying to remember what version it was it was removed in, it was in four dot something, but ...

Michael Dyrynda: Version five I think ...

Jacob Bennett: ... was it version five?

Michael Dyrynda: ... it came out.

Jacob Bennett: Oh yeah, version five. Yeah, so in version five it was removed, and there was a lot of weeping and gnashing of teeth when that happened, and there's a lot of people who missed it myself included. It's really nice, 'cause it shows you the error stack on the left hand side, and you can click into each one of those little items there and it will [00:44:00] show you exactly where it failed in the code, what line of code it was and kind of the context surrounding it, as well as any arguments that were passed in at that point.

I would assume also it does contextual binding to MySQL queries, where you have prepared statements and it just would normally have question mark, question mark, question mark, but it will show you what those question marks would have been coming through. Yeah, so it's pretty cool, and I look forward to having it back in the framework, and I'm sure people who have not seen it before will [00:44:30] be very impressed.

Michael Dyrynda: Yeah, definitely.

Jacob Bennett: Cool. Did we have anything else we wanted to talk about? ZTTP.

Michael Dyrynda: Yeah, just this ZTTP yeah.

Jacob Bennett: Yeah, why don't you take that one on for us.

Michael Dyrynda: Yeah, so ZTTP is a package that Adam Wathan released after talking about on his Full Stack radio podcast, which is basically a thin wrapper over Guzzle designed to bring in expressive syntax and simplify common use cases when dealing with HTTP endpoints. So [00:45:00] the interface is fluent. It's much simpler to access it than it would be. For anyone who's ever had to do anything with Guzzle, you know it can be a bit verbose in that you have to initialize a client, and then call a request method, and a whole bunch of options in your URL.

So instead of doing, basically newing up the client and then calling a request on that, and then decoding the response body, ZTTP basically allows you to do all of that inline [00:45:30] in a familiar sort of fluent syntax that you would be used to if you were in a Laravel application.

Jacob Bennett: Yeah, it makes these ... I don't think that these requests sorted things out, like Curl hasn't been Laravel-ified up to this point, right, and this was kind of Adam's attempt to do that right, make it seem more like what you're used to when you're in Laravel, a very, very simple way to make requests out from your application, [00:46:00] and it accomplishes that really well.

You know, a lot of my stuff is using Guzzle, and the nice thing about this is you can use this in addition to Guzzle right. I don't have to abandon the stuff that I've had previously 'cause it's just a wrapper on top of it, so I can continue to use all the stuff that I've used previously, but I can pull in ZTTP and use it where appropriate, where I don't need all of the guts and internals of Guzzle's stuff. I just need to make a really quick request out, and [00:46:30] get a response back. So yeah, it makes it really nice.

Michael Dyrynda: Yeah, and it certainly covers all of the common use cases. So it'll easily handle post, patch, put, delete, and get, and then it makes it really easy to also say that, "I want it to go through as JSON," or you can pass accept headers and things like that. So we'll put a link the show notes, but check it out if you have ever, ever felt overwhelmed by using Guzzle directly.

Jacob Bennett: Yeah, absolutely. All right, well I think that about wraps it up. This is episode [00:47:00] 39, so you can find show notes for this episode at If you liked the show, please feel free to rate it up in iTunes or your pod catcher of choice. Five stars is very much appreciated, and if you have any questions for us feel free to reach out to us on Twitter at Laravel News, or on our own personal Twitter accounts.

You will have to forgive me, I am suffering from sleep deprivation as is common when you have a child, a new child. [00:47:30] So all right Michael, thanks so much for kind of adjusting your schedule to fit.

Michael Dyrynda: Yeah, oh no. Thanks for taking the time to set this up while you are in the hospital.

Jacob Bennett: Glad to do it. Super glad to do it. It's always fun. All right Michael, we'll talk to you soon.

Michael Dyrynda: Cheers [inaudible 00:47:46].

Jacob Bennett: All right buh-bye.

Michael Dyrynda: Bye.

Speaker 5: Yeah, it's [00:48:00] a great, it's a great book.

Jacob Bennett: Yeah, so the ... Yeah, I'm sorry, my audio is kind of delayed. I can't, I'm like missing you guys as I'm talking here. One second. I'm gonna see if I can turn on any video so I can at least see your faces. Give me a second here, I gotta gather my thoughts. My brain is so mush. Oh my lord. Here, let me just tell you guys real quickly. [00:48:30] So my week, let's see, Tuesday I was up at five A.M. painting, and then Wednesday night, I was supposed to be painting that evening, and I was like, "Oh, you know, I'm really tired. I'm just gonna lay down for a half hour." Yeah, I woke up at 1:30 AM, but I was like, "I have to get this done or else I'm screwed," so I woke up at 1:30 and painted until like 3:00.

And then I was up last night from 12:30 to 4:00 because I went out to watch the first game of the finals with some friends and didn't get home 'til like almost midnight, [00:49:00] so that was a mistake. So I'm like dying now.

Speaker 5: Hey, you're hanging in there man. It's going well. It's going well.

Jacob Bennett: And we're having a baby tomorrow.

Speaker 5: Oh, like it's a scheduled baby? Yeah.

Jacob Bennett: Yeah.

Speaker 5: Congrats.

Jacob Bennett: It's a scheduled C-section, that's right.

Speaker 5: Congrats.

Jacob Bennett: Thank you. So I'm pretty sure that this lack of sleep is just at it's beginning, so it probably was a mistake to do that. I'm already sleep deprived going in to having our fourth child. Are you kidding me? Probably [00:49:30] not a good call on that one.

Speaker 5: I was gonna say, if it was your first you're probably gonna get more sleep, but no, not with your fourth.

Jacob Bennett: Nope, not with my fourth. Yeah, I'll be taking care of the other three while my wife takes care of the newborn.

Speaker 5: That's exactly right.

Laravel News Partners


Join the weekly newsletter and never miss out on new tips, tutorials, and more.