Navigated to Controllers and Middleware, Grok vs. Claude, and Developer Value - Transcript

Controllers and Middleware, Grok vs. Claude, and Developer Value

Episode Transcript

1 00:00:00,300 --> 00:00:03,580 -Hey. I'm Michael Dyrynda. -And I'm Jake Bennett. 2 00:00:03,580 --> 00:00:09,200 And welcome to episode 183 of the North Meet South Web Podcast. 3 00:00:10,320 --> 00:00:16,720 Hello, friends. It is once again that time of the week. It is Monday 4 00:00:16,720 --> 00:00:23,420 night, and, uh, it's dark out. And it's been dark for, like, the last five 5 00:00:23,480 --> 00:00:27,140 hours. I'm not digging this thing. And the thing is, I know it's gonna get even 6 00:00:27,140 --> 00:00:28,400 worse because 7 00:00:29,040 --> 00:00:33,620 shortly they're gonna change the time to be an hour... It's gonna start getting 8 00:00:33,620 --> 00:00:35,600 -dark at, like, 4:00 instead of 5:00. -Mm-hmm. 9 00:00:35,600 --> 00:00:40,720 Oh, I just hate this time of year. No fun, dude. No fun. 10 00:00:40,720 --> 00:00:41,860 -Are you- -And y- 11 00:00:41,860 --> 00:00:44,480 Are you getting rid of daylight savings? Is that what's happening? 12 00:00:44,480 --> 00:00:45,430 -Uh, you know what, man? -Or is that still- 13 00:00:45,430 --> 00:00:48,150 I feel like they've been put... I feel like they've been teasing us with this for 14 00:00:48,150 --> 00:00:49,500 -forever. -Right. Yeah, yeah. 15 00:00:49,500 --> 00:00:52,720 I really wish they would, uh, but I don't know if they are. I don't know. I feel 16 00:00:52,720 --> 00:00:56,040 like last year was like, "This is the last year they're gonna do it." And then it 17 00:00:56,040 --> 00:00:59,930 was like, "Ah, psych," or something. I don't know. We'll find out. 18 00:00:59,930 --> 00:01:01,260 -Yeah, okay. -We'll find out soon enough. 19 00:01:01,260 --> 00:01:02,990 -Find out when it happens -But I don't know. 20 00:01:02,990 --> 00:01:07,200 So I guess we... Not this weekend, next weekend, daylight saving starts here. So 21 00:01:07,200 --> 00:01:10,080 we're, you know, the day is already getting longer. It's bright when you wake 22 00:01:10,080 --> 00:01:10,240 -up. -Yup, yup. 23 00:01:10,240 --> 00:01:13,210 It's bright longer into the evening. So it's 24 00:01:13,900 --> 00:01:17,640 good for us because, you know, obviously it means you can get up a bit earlier and 25 00:01:17,640 --> 00:01:18,580 -there is some sunlight. -Yeah. 26 00:01:18,580 --> 00:01:22,140 And you finish work at the end of the day, and there is still sunlight, so. 27 00:01:22,140 --> 00:01:24,560 -Absolutely. Great. -But it has been, has been raining, which 28 00:01:24,560 --> 00:01:29,460 is, has made it difficult. Last episode we talked about my adventures with, uh- 29 00:01:29,460 --> 00:01:32,260 -Hay fever -... LawnHub. And well, hay fever, yes, but 30 00:01:32,260 --> 00:01:32,880 -LawnHub. -Mm-hmm. 31 00:01:32,880 --> 00:01:37,640 And I had to, had to go out and spray the weeds. And it says you're not supposed to 32 00:01:38,620 --> 00:01:42,860 do that if there's going to be rain within four hours. And when- 33 00:01:42,860 --> 00:01:44,480 -Ah -... I'm planning this ten days in advance, 34 00:01:44,480 --> 00:01:46,390 it's very hard to tell if there's going to be rain. 35 00:01:46,390 --> 00:01:48,120 -It is. Yes. -Because even if they can predict ten days 36 00:01:48,120 --> 00:01:52,020 -in advance, it's never correct. -Not n- Yeah, exactly. Exactly. 37 00:01:52,020 --> 00:01:55,200 So, you know, I, I got up on that day, and I look outside, and I'm like, "It doesn't 38 00:01:55,200 --> 00:01:58,880 look like it's gonna rain." And then I went for a, a run in the morning, or I 39 00:01:58,880 --> 00:02:03,160 went for a walk in the morning, and, and I got rained on. And I thought, "Okay, 40 00:02:03,160 --> 00:02:09,008 well, this has not bode well." And then I, I waited a bit and there was no rain. And 41 00:02:09,008 --> 00:02:12,920 I, I checked the, the forecast, and it said there's no rain due until, you know, 42 00:02:12,920 --> 00:02:15,880 three o'clock in the afternoon. This is 10:00 in the morning. I'm like, "Okay, I'm 43 00:02:15,880 --> 00:02:20,960 gonna go out, and I'll spray the weeds now." And I got almost finished, and it 44 00:02:20,960 --> 00:02:22,880 -started raining. -Ah. 45 00:02:22,880 --> 00:02:24,600 -You know, 30 minutes later, I'm like- -Oh my gosh. Pointless. 46 00:02:24,600 --> 00:02:26,020 -Come on. -I just wasted all that stuff. 47 00:02:26,020 --> 00:02:27,320 -Come on. -Yeah. 48 00:02:27,320 --> 00:02:30,740 But, uh, it, it seems to have worked though, 'cause I went out the next day and 49 00:02:30,740 --> 00:02:32,609 all of the, the weeds that I had sprayed had started- 50 00:02:32,609 --> 00:02:33,180 Yeah, but it'll still be at least, like, partially effective 51 00:02:33,180 --> 00:02:36,360 -... drooping and stuff, so. -Yeah. Yeah, it'll be fine. It'll be fine. 52 00:02:36,360 --> 00:02:39,980 So yeah, the next one is in, in 14 days when I have to go out and spray the actual 53 00:02:39,980 --> 00:02:43,400 fertilizer on the lawn, will be interesting. So I'm gonna, I'm gonna see 54 00:02:43,400 --> 00:02:46,840 if I can go and hire a dethatcher or a scarifier- 55 00:02:46,840 --> 00:02:47,780 -Oh, yeah -... whatever you call it- 56 00:02:47,780 --> 00:02:50,360 -Yeah, sure. Mm-hmm -... to go and, like, pull up all of the, 57 00:02:50,360 --> 00:02:53,630 the deadness from the surface of the, of the- 58 00:02:53,630 --> 00:02:55,300 -Yep -... lawn before I then go and put down the 59 00:02:55,300 --> 00:02:57,880 fertilizer. And, and hopefully that will help to rejuvenate it. So- 60 00:02:57,880 --> 00:03:01,180 Are you gonna, are you gonna aerate the soil too? You gonna pile out, pull out the 61 00:03:01,180 --> 00:03:02,290 -plugs and all that stuff? -Mm-mm. No, I'm probably- 62 00:03:02,290 --> 00:03:04,380 Dude, you're gonna become one of those lawn guys? 63 00:03:04,380 --> 00:03:08,420 No, I'm probably not gonna go that far. The scarifier I would do because it's, 64 00:03:08,420 --> 00:03:11,300 like, you know, a machine that you can hire that goes through and does it. 65 00:03:11,300 --> 00:03:13,130 -Yep, yep. -But anything that involves too much manual 66 00:03:13,130 --> 00:03:15,359 labor is something that I'm not that interested in, so. 67 00:03:15,360 --> 00:03:18,160 -Mm-hmm. -I have... Like, if, as long as I fertilize 68 00:03:18,160 --> 00:03:22,020 the lawn, it tends to come up okay. It's when it starts to get cold and wet, and I 69 00:03:22,020 --> 00:03:24,1000 go, "I'm not gonna go out there and mow the lawn," 'cause it just turns to mush, 70 00:03:25,000 --> 00:03:26,800 -right? -Yeah. Yeah, absolutely. Uh-huh. 71 00:03:26,800 --> 00:03:30,320 And so, you do that once, and then before you know it, the weeds grow, you know- 72 00:03:30,320 --> 00:03:31,680 -Yep, yep, yep -... as high as your knees. And then you go 73 00:03:31,680 --> 00:03:34,640 and, and then you've gotta go and mow it, like, four times just to get it down to 74 00:03:34,640 --> 00:03:39,580 level. And by that point, it's too late, and it's just turned into weeds. So 75 00:03:40,580 --> 00:03:42,400 -I'm hoping it should be okay. -Hey, speaking of Scarify, 76 00:03:42,700 --> 00:03:45,700 speaking of Scarify, Halloween is around the corner. 77 00:03:45,700 --> 00:03:45,940 Yeah. 78 00:03:46,620 --> 00:03:48,120 -We're transitioning- -Do you guys do Hallow- 79 00:03:48,120 --> 00:03:49,810 -No -Do you guys do Halloween? Do you guys do 80 00:03:49,810 --> 00:03:51,880 -Halloween? -No, although we've been invited to a, a 81 00:03:51,880 --> 00:03:55,420 -Halloween birthday party, which I'm- -Oh, that sounds fun. 82 00:03:55,420 --> 00:03:55,960 Yeah. So 83 00:03:56,600 --> 00:04:00,840 for, for, uh... How old is he? Uh, uh, uh- 84 00:04:00,840 --> 00:04:02,120 -Nine. -I can't remember if this is the older 85 00:04:02,120 --> 00:04:04,380 -child or the younger child. -Eli's hanging out with the older kids 86 00:04:04,380 --> 00:04:05,700 these days. He's moving on up. 87 00:04:06,380 --> 00:04:10,280 Yeah. Yeah, he certainly is. Yeah. I am... It occurred to me that we were, we... One 88 00:04:10,280 --> 00:04:14,480 of the kids from school that lives, like, two doors down, he's in the, the year 89 00:04:14,480 --> 00:04:16,469 above Eli. And, um, 90 00:04:17,240 --> 00:04:21,380 we went around... With, with them, we went to the park. We had, like, a kick of the, 91 00:04:21,380 --> 00:04:24,240 the soccer ball, we played a bit of basketball, we pushed some kids on the 92 00:04:24,240 --> 00:04:27,820 swings. It was, it was a good bit of fun. But one of the other kids was there, plays 93 00:04:27,820 --> 00:04:32,180 in Eli's soccer team. And I was trying to put two and two together, like, how, how 94 00:04:32,180 --> 00:04:36,610 is this child friends with the older kid when he plays in Eli's soccer team? 95 00:04:36,610 --> 00:04:38,180 -Yeah, sure. -And it took me a while to realize that he 96 00:04:38,180 --> 00:04:39,340 is actually an older kid 97 00:04:39,980 --> 00:04:40,680 -playing- -Ah, okay 98 00:04:40,680 --> 00:04:45,480 ... down a grade in soccer. So he is in, in the older kids' year level, so. 99 00:04:45,480 --> 00:04:46,350 -That's fun. -But, uh- 100 00:04:46,350 --> 00:04:47,940 -Yeah. -You know, they played, they played 101 00:04:47,940 --> 00:04:51,800 together for two terms before I realized this. 102 00:04:51,800 --> 00:04:52,500 -That's fun. -So- 103 00:04:52,500 --> 00:04:55,360 Yeah, no. It's good, probably good for Eli to play up with, like, a little bit older 104 00:04:55,360 --> 00:04:57,430 -kids and stuff. -Mm-hmm. 105 00:04:57,430 --> 00:04:59,780 And yeah, I'm sure he gets... You know, it's like you play to the level of your 106 00:04:59,780 --> 00:05:01,790 competition or of your teammates, I suppose. 107 00:05:01,790 --> 00:05:03,240 -It's, uh, yeah. -And so you probably get better as you 108 00:05:03,240 --> 00:05:07,060 play. Yeah. So we, um... Harrison had a soccer game this last Saturday and scored 109 00:05:07,060 --> 00:05:11,070 two goals. He was practicing his hat trick dance if he got three goals. 110 00:05:11,070 --> 00:05:12,700 -Ah, yes. If he gets three, yeah. -And so he, yeah, he had it all planned 111 00:05:12,700 --> 00:05:17,640 out. Oh, he was... He wanted it so bad. He had a couple, like... He got two goals 112 00:05:17,640 --> 00:05:19,200 -and then he- -Mm-hmm 113 00:05:19,200 --> 00:05:21,1000 ... kicked a third. It was high, it had a lot of, like, spin on it. Like, hit right 114 00:05:22,000 --> 00:05:23,640 in front of the goal and bounced backwards. 115 00:05:23,640 --> 00:05:25,980 -Yeah. -Like, uh, did not go into the goal. Yeah. 116 00:05:25,980 --> 00:05:27,180 -Then he had a couple of those. Anyway- -Good. 117 00:05:27,180 --> 00:05:30,270 It was fun. He almost made it. It was, it was the last game of the season, so it was 118 00:05:30,270 --> 00:05:31,130 -like his last chance- -Mm-hmm 119 00:05:31,130 --> 00:05:37,160 ... to get it. But no, it was, it was all fun. All fun. Um, yeah. Okay. I've... You 120 00:05:37,160 --> 00:05:39,320 know, when we started this, this show we're like, "What should we talk about?" 121 00:05:39,320 --> 00:05:44,620 Well, I've got a couple things. First of all, um, have you ever seen these 1Up 122 00:05:44,620 --> 00:05:50,300 Arcade boxes? So, like, they're, like, not a full arcade cabinet, but, like, it's, 123 00:05:50,300 --> 00:05:55,360 th- they're like mini arcade cabinets, if you will. So, like, 1Up Arcade, Street 124 00:05:55,360 --> 00:05:58,780 Fighter, they've got whatever. So David Hemphill and I are big into Street 125 00:05:58,780 --> 00:06:01,840 Fighter. We played, uh, Street Fighter when we were at Lari: Con this year. That 126 00:06:01,840 --> 00:06:03,560 -was fun. Um- -Mm-hmm. 127 00:06:03,560 --> 00:06:07,099 But I always wanted a little Street Fighter box. And so I found one on 128 00:06:07,100 --> 00:06:09,599 Facebook Marketplace, this guy was selling it for, like, 100 bucks. I'm like, "Why 129 00:06:09,600 --> 00:06:12,560 is he selling it for ch- so cheap?" Well, turns out he was trying to convert it to, 130 00:06:12,560 --> 00:06:17,450 like, a RetroPie.Which is like a Raspberry Pi with, like, the software... 131 00:06:17,450 --> 00:06:18,460 -Mm-hmm -... installed on it that allows you to 132 00:06:18,460 --> 00:06:21,700 download ROMs and then use all the stuff. So he had done all the conversion on it. 133 00:06:21,700 --> 00:06:25,659 Like, where you have to swap out all the buttons, you have to buy this, like, LCD, 134 00:06:25,659 --> 00:06:29,640 um, converter that will hook it up to the port. He bought all the parts, had done 135 00:06:29,640 --> 00:06:33,740 all the things, and could not get the last step. Could not get it to work, just 136 00:06:33,740 --> 00:06:34,650 didn't have the chops, 137 00:06:35,440 --> 00:06:38,740 and so... Or so I thought. And so I was like, "Well..." 138 00:06:38,740 --> 00:06:40,320 -Mm-hmm. -"...I'll figure this out, no big deal." 139 00:06:40,320 --> 00:06:43,969 Well, no, it's been sitting in my basement for two months and I have not been able 140 00:06:43,969 --> 00:06:47,880 to get it to work. And then I rewatched a couple tutorials and realized there was a 141 00:06:47,880 --> 00:06:50,130 ribbon cable that was flipped around the opposite way. 142 00:06:50,130 --> 00:06:51,500 -Wow. -Turned it around, plugged it in. That was 143 00:06:51,500 --> 00:06:55,780 it, dude, I was, I was off and running. And so that's been so fun, been playing 144 00:06:55,780 --> 00:06:57,780 -with that, like- -It's wild they did something so simple. 145 00:06:57,780 --> 00:06:59,840 -Oh, seriously. I mean, it's just- -But yeah, I suppose if you, if you flip 146 00:06:59,840 --> 00:07:01,610 -the pins, then it's, uh... -Yes. 147 00:07:01,610 --> 00:07:05,260 But, uh, you know, this is why, uh, PC cases have always had the little notch so 148 00:07:05,260 --> 00:07:07,400 that you could never get it the other way around. 149 00:07:07,400 --> 00:07:08,120 -Yes. Yep, not this- -Because you don't wanna s- 150 00:07:08,120 --> 00:07:10,080 -... not this one. -You don't wanna r- yeah, you don't wanna 151 00:07:10,080 --> 00:07:13,169 -reverse, uh- -Yeah, polarity order, yeah 152 00:07:13,169 --> 00:07:14,120 ... electricity going to the motherboard, huh? 153 00:07:14,120 --> 00:07:18,140 Exactly. And so anyway, dude, that's been so fun, and it's a really fun little, 154 00:07:18,140 --> 00:07:20,010 like, hobby project. Now, the cool thing is, like- 155 00:07:20,010 --> 00:07:21,520 -Mm-hmm -... I didn't have to pay $400 for it. I 156 00:07:21,520 --> 00:07:24,070 paid, like, 100 bucks for it, and then half was already bought. 157 00:07:24,070 --> 00:07:25,919 -Yeah, it's pretty good. -So yeah, it's, it's been a little, it's 158 00:07:25,919 --> 00:07:28,539 been a lot of fun just playing around with that. Me and Harrison played some Street 159 00:07:28,539 --> 00:07:32,099 Fighter today, and we both like that game, and so... Yeah, that's been pretty cool, 160 00:07:32,099 --> 00:07:35,450 so I would suggest that as a fun little hobby to anybody if they're interested. 161 00:07:35,450 --> 00:07:38,799 There's, uh, there's some cool little mods you can do out there with it and it's, 162 00:07:38,799 --> 00:07:40,840 -it's pretty fun, so that's been cool. -All right. 163 00:07:40,840 --> 00:07:43,340 -Um, yeah. -I can, we can buy these things here, uh- 164 00:07:43,340 --> 00:07:45,440 -Nice, yeah -... Mortal Kombat, Mortal Kombat Deluxe... 165 00:07:45,440 --> 00:07:45,510 Yes. 166 00:07:45,510 --> 00:07:48,049 Arcade machine has 14 games, Mortal Kombat 1, 167 00:07:48,659 --> 00:07:55,280 2, 3. There's some other Mortal Kombat and a few other random games on there, 168 00:07:55,280 --> 00:07:59,159 -thousand bucks, plus delivery. -Yeah. 169 00:07:59,159 --> 00:08:02,400 -All right, good times. -Yeah. Yep. So this is almost... Yeah 170 00:08:02,400 --> 00:08:04,580 -Lose that before I spend money. -The- the pri- yeah, exactly. The price was 171 00:08:04,580 --> 00:08:06,360 right. Like, it was, it was way cheap, and I was... 172 00:08:06,360 --> 00:08:07,640 -Mm-hmm. -"Yeah, I'll try this out." So that's been, 173 00:08:07,640 --> 00:08:08,510 -that's been kind of fun... -Yeah 174 00:08:08,510 --> 00:08:10,860 ... to just mess around with but, and finally got it working. 175 00:08:10,860 --> 00:08:13,700 -Love it. -Um, the other thing that I wanted to talk 176 00:08:13,700 --> 00:08:14,730 about though is 177 00:08:15,919 --> 00:08:18,520 we've talked a lot about the permissions stuff, right? 178 00:08:18,520 --> 00:08:20,750 -Mm-hmm. -And so I- I wanna, I wanna sorta share the 179 00:08:20,750 --> 00:08:23,600 saga with you, if I can. Um, 180 00:08:24,419 --> 00:08:27,740 so we talked originally about how we went through all of our applications, and 181 00:08:27,740 --> 00:08:32,480 previously we only had roles, and we replaced any place where we are checking a 182 00:08:32,480 --> 00:08:37,1000 role with a named permission. So instead of saying has role admin or has role 183 00:08:38,000 --> 00:08:41,370 manager, we would say, "Nope, what are we trying to do in this place? Oh, we're 184 00:08:41,370 --> 00:08:46,300 trying to edit a blog post. Okay, so we're gonna replace that with a check to say 185 00:08:46,300 --> 00:08:47,100 permission enum 186 00:08:47,980 --> 00:08:49,930 -edit blog post." Right? -Mm-hmm. 187 00:08:49,930 --> 00:08:51,880 -That's- that's what it was. Um- -Yeah 188 00:08:51,960 --> 00:08:56,240 ... and then we used attributes to associate active directory group, security 189 00:08:56,240 --> 00:08:59,980 group names with those permissions, and then in active directory we just set those 190 00:08:59,980 --> 00:09:03,079 permissions, or we set those groups, those security groups on the particular 191 00:09:03,079 --> 00:09:05,400 users that need those things. It works great. Works really, really well. 192 00:09:05,400 --> 00:09:06,360 -Yeah. -It's pretty cool. 193 00:09:06,360 --> 00:09:08,160 -I think. -We've had some other interesting solutions 194 00:09:08,160 --> 00:09:11,060 around that. Okay, that's the, that's that side of it. 195 00:09:12,380 --> 00:09:16,540 Um, now, the question has been, where do we do those permission checks? And all 196 00:09:16,540 --> 00:09:19,260 we're doing with those permission checks is we're just doing gates, right? We're 197 00:09:19,260 --> 00:09:20,540 -setting up gates... -Yeah 198 00:09:20,540 --> 00:09:24,960 ... um, so that you can use Laravel's default can. You have can middleware, you 199 00:09:24,960 --> 00:09:27,400 -have a can directive, you have... -Mm-hmm. 200 00:09:27,400 --> 00:09:30,680 You know, this authorize that you can use inside of the controller if your 201 00:09:30,680 --> 00:09:35,420 controllers are auth- y- you know, using the authorizable trait. Um, you can do it 202 00:09:35,420 --> 00:09:39,110 inside of a form request, you can do it, you know, a bunch of different places. 203 00:09:39,110 --> 00:09:41,860 -Yeah. -Um, you can, uh, 204 00:09:41,920 --> 00:09:44,900 you know, you could just use the gate facade. There's all sorts of ways that you 205 00:09:44,900 --> 00:09:48,880 can do this, right? And so the way that we had previously done it, like, as our 206 00:09:48,880 --> 00:09:53,219 first step is we just replaced any of the middleware checks, um, in our routes file 207 00:09:53,220 --> 00:09:56,040 with can middleware checks, and, uh, I mean, totally fine. 208 00:09:57,100 --> 00:10:01,780 But that sort of broke down a little bit. Um, we ended up having to, like, rearrange 209 00:10:01,780 --> 00:10:04,749 -how our routes files were set up, and... -Yeah. 210 00:10:04,749 --> 00:10:09,339 ... you'd end up having to, like, break apart different pieces, um, based on- 211 00:10:09,339 --> 00:10:12,900 -Just to get the granularity. -Exactly. And so, like, you'd have a route 212 00:10:12,900 --> 00:10:15,800 file that would belong with another one, like, co-located with it that would have 213 00:10:15,800 --> 00:10:19,240 to be, like, further down, and then ended up being like, there'd be a merge conflict 214 00:10:19,240 --> 00:10:22,440 and somebody, like, fixed the merge conflict but they accidentally moved one 215 00:10:22,440 --> 00:10:23,270 -out of that group. -Yeah, yeah. 216 00:10:23,270 --> 00:10:26,360 And so now it was without permissions because, you know, it's just, like, in the 217 00:10:26,360 --> 00:10:28,040 -routes file, and so- -Yeah 218 00:10:28,040 --> 00:10:30,260 ... I was like, "We can't do that anymore." Um... 219 00:10:30,260 --> 00:10:32,039 -Mm-hmm. -We- we've gotta... It- it just did not 220 00:10:32,039 --> 00:10:36,219 feel like it was close enough to the metal. It just felt like it was so s- sort 221 00:10:36,219 --> 00:10:38,400 -of, like, out there and removed. -Yeah. Yeah. 222 00:10:38,400 --> 00:10:38,690 Um, 223 00:10:39,660 --> 00:10:43,180 and so, um, so first off, like, do you identify with that at all? Like, do you 224 00:10:43,180 --> 00:10:46,480 feel that? Like, do you ever feel like if you're doing a- a middleware check or a 225 00:10:46,480 --> 00:10:50,500 can check out at the edge there on the routes file, does that ever make you feel 226 00:10:50,500 --> 00:10:53,800 a little bit like, "Eh, feels a little too fragile"? 227 00:10:53,800 --> 00:10:56,980 I don't know off the top of my head anywhere where we are doing 228 00:10:58,120 --> 00:11:00,690 an authorization check in our routes file. 229 00:11:00,690 --> 00:11:02,900 -Okay. -Like, maybe very high level, but- but 230 00:11:02,900 --> 00:11:05,460 -nothing granular. I think all of that- -Sure 231 00:11:05,460 --> 00:11:07,010 -... granularity... -Like, are... yeah. Sure, like- 232 00:11:07,010 --> 00:11:10,260 ... all those authorization checks will push down into a form request or into, 233 00:11:10,260 --> 00:11:14,839 like, an action class if we wanna enforce that behavior deep into the- the business 234 00:11:14,839 --> 00:11:16,810 rules of that behavior. 235 00:11:17,420 --> 00:11:20,520 But- but typically, it'll be in- in the authorize method of a 236 00:11:21,880 --> 00:11:24,220 form request or inside of, like, an a- 237 00:11:25,079 --> 00:11:25,900 an action class, 238 00:11:26,540 --> 00:11:30,1000 -somewhere where we're authorizing that. -Okay. So that l- that brought me to my 239 00:11:31,000 --> 00:11:34,700 next step, which was, okay, so if we're not gonna do it in the middleware, we 240 00:11:34,700 --> 00:11:38,720 have, uh, we can- we can do it inside of each controller, uh, method. 241 00:11:38,720 --> 00:11:40,460 -Mm-hmm. Mm-hmm. -Right? So if we're using resourceful 242 00:11:40,460 --> 00:11:43,839 controllers, um, we can just do a 243 00:11:43,900 --> 00:11:46,220 -this authorize, um... -Yeah 244 00:11:46,220 --> 00:11:48,1000 ... or request authorize or whatever it is, this authorize, and that's gonna pass 245 00:11:49,000 --> 00:11:52,200 in the user, and then you can just pass in the permissions check, which is fine. 246 00:11:52,200 --> 00:11:54,200 That- that works great. But 247 00:11:54,819 --> 00:11:58,460 it's, like, I sort of hate having to have those at the top of every controller 248 00:11:58,460 --> 00:12:04,780 method. It sorta sucks. And so you have some options, right? Um, one option that 249 00:12:04,780 --> 00:12:08,560 was really interesting and attractive to me was that if you're dealing with a 250 00:12:08,560 --> 00:12:14,339 resource, like a blog post, for example, instead of having to put that in every 251 00:12:14,339 --> 00:12:19,808 single method...Um, this gate check, this authorize check, in the constructor you 252 00:12:19,808 --> 00:12:25,348 could say, "This authorize resource," and then you could point it at the policy that 253 00:12:25,348 --> 00:12:29,458 you had created, if you created a policy, like a post policy. 254 00:12:29,458 --> 00:12:30,848 -Mm-hmm. -And then you could do your, your gate 255 00:12:30,848 --> 00:12:36,007 checks in there. So inside of that, you could just kind of say, you know, um, 256 00:12:36,068 --> 00:12:39,938 "Here are the different a- view any, view, edit, update, whatever." 257 00:12:39,938 --> 00:12:41,266 -Mm-hmm. -And you would just say, "Authorize 258 00:12:41,267 --> 00:12:45,708 resource, here's the policy," and it would automatically apply the correct policy 259 00:12:45,708 --> 00:12:48,418 check to the proper method, which was amazing. 260 00:12:48,418 --> 00:12:49,747 -Yeah. -I was like, "This is great." Okay, so 261 00:12:49,747 --> 00:12:52,418 we're gonna move everything to policies now. 262 00:12:52,418 --> 00:12:54,308 -Mm-hmm. -Everything to policies, and then we'll do 263 00:12:54,308 --> 00:12:58,448 our, you know, our permission checks inside of those policies so we know like, 264 00:12:58,448 --> 00:13:00,928 okay, you go to the controller, the controller's gonna have an authorize 265 00:13:00,928 --> 00:13:03,588 resource. And then at the top you're gonna click through that, and that's gonna get 266 00:13:03,588 --> 00:13:07,007 you to your policy. And the policy is gonna define the, the different, you know, 267 00:13:07,007 --> 00:13:09,767 permissions that they need in order to be able to do these things. Very well 268 00:13:09,767 --> 00:13:12,068 organized, very clean, super nice, loved it. 269 00:13:12,068 --> 00:13:15,228 -Yeah. -And then Laravel 12 came along. 270 00:13:16,127 --> 00:13:18,808 And Laravel 12 basically nukes all of that. 271 00:13:18,808 --> 00:13:20,667 -Mm-hmm. -It does not use the authorize resource 272 00:13:20,667 --> 00:13:23,828 anymore, it is not in the docs anymore, and 273 00:13:24,428 --> 00:13:28,208 now it's back to, and all the docs recommend using 274 00:13:28,808 --> 00:13:34,228 Gate.dodop.authorize inside of every controller method. 275 00:13:34,228 --> 00:13:36,127 -Mm-hmm. -And I'm just like, "I hate this. 276 00:13:36,808 --> 00:13:38,988 I really-" "...hate how it looks." And so I know- 277 00:13:38,988 --> 00:13:41,288 -Mm-hmm -...what you're saying is you just use a 278 00:13:41,288 --> 00:13:43,068 -form request in that case, right? -Yeah. 279 00:13:43,068 --> 00:13:47,088 If you want to, if you want to do that authorization check, you're just gonna 280 00:13:47,088 --> 00:13:50,808 say, "I am, I am going to do that inside of a form request 281 00:13:51,588 --> 00:13:56,208 for every method inside of all those controllers," right? 282 00:13:56,208 --> 00:13:57,988 -Yeah. -Um, is that accurate? Is that how you 283 00:13:57,988 --> 00:14:02,188 -would do it? -Yeah. And we, we also typically use a lot 284 00:14:02,188 --> 00:14:04,538 -of single action controllers because- -Mm-hmm 285 00:14:04,538 --> 00:14:10,788 ...we are not, like we're not building a crud, cruddy app really. Um- 286 00:14:10,788 --> 00:14:12,948 -Yeah -...we have lots of components, and 287 00:14:12,948 --> 00:14:16,637 components make requests to specific routes. 288 00:14:16,637 --> 00:14:20,507 -Endpoints, yeah, sure. -Endpoints that are responsible for doing 289 00:14:20,507 --> 00:14:25,988 particular things. So yeah, we, we will typically have an action that is called, 290 00:14:25,988 --> 00:14:28,767 uh, from a controller that is, um, 291 00:14:29,708 --> 00:14:34,007 past a, a request object which is responsible for doing the authorization. 292 00:14:34,007 --> 00:14:39,608 And whether, you know, whether it's a, a get endpoint or an index endpoint where 293 00:14:39,608 --> 00:14:44,137 like, some things don't need to be authorized, and so the authorize method of 294 00:14:44,137 --> 00:14:47,208 -that form request will just return true. -Yeah, sure. 295 00:14:47,208 --> 00:14:51,108 But there will be some index methods where we do need to do tho- those checks in 296 00:14:51,108 --> 00:14:56,108 there. And so we will do the authorization inside of, you know, a otherwise empty 297 00:14:56,108 --> 00:15:01,828 form request. But it gives us, you know, extra files around the place, but they are 298 00:15:01,828 --> 00:15:08,468 consistently named and consistently located. So if we have like a, a 299 00:15:08,468 --> 00:15:13,468 user index controller, for example, then we would also have a user index request 300 00:15:14,267 --> 00:15:17,528 that goes in, you know, the, the request folder or whatever. But if you are using 301 00:15:17,528 --> 00:15:22,407 your fuzzy, fuzzy finder in your editor, you're going to type, you know, user index 302 00:15:22,407 --> 00:15:25,627 and you will see the request and the controller there, uh, next to each other. 303 00:15:25,627 --> 00:15:28,407 So it's easy enough to find 'em. And then you'll also have the user index action 304 00:15:28,407 --> 00:15:32,228 perhaps. Um, and so all of this stuff, because it's, it's got like a 305 00:15:32,848 --> 00:15:37,578 s- a common prefix, it all comes up when you're searching for it. Um, 306 00:15:39,328 --> 00:15:42,588 your mileage may vary depending on whether or not you'll, you're navigating the file 307 00:15:42,588 --> 00:15:45,887 -tree or if you're using fuzzy find. Um- -Sure, sure 308 00:15:45,887 --> 00:15:49,507 ...you know, obviously as a VIM user, my hand's on the keyboard so, uh- 309 00:15:49,507 --> 00:15:52,028 -Yeah, yeah -...it's, it's more common that I will find 310 00:15:52,028 --> 00:15:56,407 things that way. Um, and that also then extends to tests, like if you've got a 311 00:15:56,407 --> 00:16:01,127 user index test, for example, um, or a user index controller test, whatever you 312 00:16:01,127 --> 00:16:05,048 wanna call it, all of these things will appear, you know, at the top of your 313 00:16:05,048 --> 00:16:06,588 search anyway. So 314 00:16:06,588 --> 00:16:10,208 it makes it easier from that perspective to locate things rather than having to 315 00:16:10,208 --> 00:16:13,728 traverse the directory tree to look in like a request folder or a controllers 316 00:16:13,728 --> 00:16:19,548 folder or wherever else. It's all just there. Um, so yeah, more files but 317 00:16:19,548 --> 00:16:22,167 they're, they're typically very small files, 318 00:16:22,808 --> 00:16:25,988 but it also then allows us to co-locate that behavior where it makes the most 319 00:16:25,988 --> 00:16:27,478 -sense. You know, requests- -Yeah 320 00:16:27,478 --> 00:16:30,948 ...and authorization kind of go together. Controllers are really 321 00:16:31,808 --> 00:16:35,968 just for delegating, you know, taking some data, passing it to some action and 322 00:16:35,968 --> 00:16:39,528 returning some response. But they're, they're typically, you know, no more than 323 00:16:39,528 --> 00:16:40,747 five or six lines long. 324 00:16:41,608 --> 00:16:46,247 Right. Yeah, and I think, I think for me, I get it, like I get... I'm not 325 00:16:46,247 --> 00:16:48,137 necessarily so concerned with 326 00:16:49,088 --> 00:16:53,028 making a new form request for every single thing, although it does sort of suck, 327 00:16:53,028 --> 00:16:56,647 honestly. Um, and I think it's just because it's like, how many levels of 328 00:16:56,647 --> 00:16:59,848 indirection do I have to have before I finally get down to the thing? You know 329 00:16:59,848 --> 00:17:00,578 -what I mean? -Mm-hmm. 330 00:17:00,578 --> 00:17:03,588 'Cause it's like the reason we organized it around policies is because we were 331 00:17:03,588 --> 00:17:06,187 like, "Okay great, we're gonna treat them as resources." Okay, so now we have 332 00:17:06,187 --> 00:17:06,798 -policies. -Mm-hmm. 333 00:17:06,798 --> 00:17:10,907 Wonderful. But now it's like we're sort of saying, well, I mean maybe it's a policy 334 00:17:10,907 --> 00:17:13,708 but we're basically gonna have a form request for every single one of them 335 00:17:13,708 --> 00:17:16,208 every, anyway, so what's the point of having the policy? 336 00:17:16,208 --> 00:17:18,447 -Mm-hmm. -Like, now the pol- so, so now I go 337 00:17:19,108 --> 00:17:25,088 route controller, method, form request, authorize, policy, then permission? 338 00:17:25,088 --> 00:17:25,848 -Mm-hmm. -I mean, holy crap. 339 00:17:25,848 --> 00:17:27,728 -Mm-hmm. -That's like seven layers of indirection to 340 00:17:27,728 --> 00:17:28,788 -get down to the actual- -Yeah 341 00:17:28,788 --> 00:17:32,288 ...permission check. It's crazy. And so it's like, if you're gonna do that, if 342 00:17:32,288 --> 00:17:36,348 you're going to do a form request, it almost feels like you could do without the 343 00:17:36,348 --> 00:17:39,078 -policy, um, because- -Mm-hmm 344 00:17:39,078 --> 00:17:42,228 ...like, I don't really, I'm not using it almost anywhere else- 345 00:17:42,228 --> 00:17:44,788 -Yeah -...except for in the controller. And so- 346 00:17:44,788 --> 00:17:46,388 -Yeah -...you know, if I'm going to create the 347 00:17:46,388 --> 00:17:50,348 form requests, I almost don't wanna create the policies because- 348 00:17:50,348 --> 00:17:53,528 -Yeah -...I don't wanna do one more layer. 349 00:17:54,467 --> 00:17:57,078 Yeah. It also depends. Like if you're very 350 00:17:57,768 --> 00:18:01,998 resource-centric as it seems to be that you are, then, you know, the policies- 351 00:18:01,998 --> 00:18:05,788 -I mean, sometimes it's- -...do make sense. But we, we definitely 352 00:18:05,788 --> 00:18:07,128 err on the side of 353 00:18:07,947 --> 00:18:12,548 not having resources. Like we're not updating people and businesses and 354 00:18:12,548 --> 00:18:17,608 addresses and things like that as commonly as we are adding a person to application 355 00:18:17,608 --> 00:18:22,388 or add address to person or, you know, all of this kind of stuff where these actions 356 00:18:22,388 --> 00:18:26,984 kind of dictate what's happening.So, um, and so whether or not you have access to 357 00:18:26,984 --> 00:18:33,804 do that action is kind of decoupled from the resource itself. Whereas 358 00:18:33,804 --> 00:18:37,604 you, because you've got the policies and that kinda stuff, you're- you're more 359 00:18:37,604 --> 00:18:39,254 leaning towards that side of things, 360 00:18:40,344 --> 00:18:45,764 so it probably makes more sense to use the policies. Um, but I still think, you 361 00:18:45,764 --> 00:18:49,304 know, the form requests just make a- a consistent... Yeah. Yeah, it's seven 362 00:18:49,304 --> 00:18:54,404 layers and it's more things, et cetera, but it's always gonna be in the same 363 00:18:54,404 --> 00:18:58,624 place. You don't have to stop and think, "Oh, hang on. This is an index method. 364 00:18:58,624 --> 00:19:01,394 Where do I authorize this now?" No, it just goes in the form request. 365 00:19:01,394 --> 00:19:02,124 -Yeah. -Like- 366 00:19:02,124 --> 00:19:04,934 -Mm-hmm -... yes, extra file, yes, extra location. 367 00:19:05,544 --> 00:19:10,344 Potentially, like, if you're doing the policy and, you know... But it, but it 368 00:19:10,344 --> 00:19:14,484 means that you can guard those things directly as well, using the policies. 369 00:19:15,084 --> 00:19:15,324 Yeah. 370 00:19:15,324 --> 00:19:16,324 -Um, where- -I guess that's- 371 00:19:16,324 --> 00:19:19,164 ... you're not necessarily encapsulating business logic behind 372 00:19:19,784 --> 00:19:24,524 -a request or an action or whatever else. -Yeah. Okay, so here's the last piece with 373 00:19:24,524 --> 00:19:28,134 the form request thing. So, like, there will be... So there are places where we do 374 00:19:28,134 --> 00:19:31,714 have more intensive sort of policy logic. So for example- 375 00:19:31,714 --> 00:19:34,384 -Mm-hmm -... I'll have, like, a coaching entry, 376 00:19:34,384 --> 00:19:34,544 right? 377 00:19:35,364 --> 00:19:40,464 And for that, a coaching... And, like, if somebody... The ability to be able to view 378 00:19:40,464 --> 00:19:46,124 a coaching entry depends on if it is... Like, if the person that's logged 379 00:19:46,124 --> 00:19:52,544 in, if their user ID is the person that is, like... They're the coachable team 380 00:19:52,544 --> 00:19:53,404 -member ID- -Mm-hmm 381 00:19:53,404 --> 00:19:54,464 -... or something like that, right? -Mm-hmm. 382 00:19:54,464 --> 00:19:57,904 They're the person who's being coached. So if it belongs to them, they can see it. 383 00:19:57,904 --> 00:20:03,144 Or if it is a person who directly manages them. So if they're anywhere within... So 384 00:20:03,144 --> 00:20:06,843 indirectly or directly manages them. So if they're anywhere in the tree of that 385 00:20:06,844 --> 00:20:07,254 -person's- -Mm-hmm 386 00:20:07,254 --> 00:20:10,724 ... purview, they can be seen, right? Where does that live? That has to live 387 00:20:10,724 --> 00:20:12,904 inside the policy. That's the logical place for it to live. 388 00:20:12,904 --> 00:20:13,764 -Mm-hmm. -My question is, 389 00:20:14,564 --> 00:20:21,524 if I'm doing that, um, does the... So, like, let's say the, uh, the view 390 00:20:21,524 --> 00:20:26,924 coaching entry request, right? Or is it coaching entry view request? Which one is 391 00:20:26,924 --> 00:20:30,144 it? Coaching entry show request? Is that what you'd call it? 392 00:20:30,144 --> 00:20:33,563 Yeah, it's show coaching entry request, I think. 393 00:20:33,563 --> 00:20:37,504 -Okay. So verb and then model and then- -Mm-hmm. Mm-hmm. Yeah 394 00:20:37,504 --> 00:20:38,424 -... yeah? Okay. -Yeah. 395 00:20:38,424 --> 00:20:43,264 So show coa- so show coaching entry request. If I do that, um- 396 00:20:43,264 --> 00:20:44,934 -Mm-hmm -... does the show coaching entry request 397 00:20:44,934 --> 00:20:49,544 authorize the method, have access to the ID or to the currently hydrated, eager 398 00:20:49,544 --> 00:20:55,724 loaded, um, model binding, right? Does that make sense? 399 00:20:55,724 --> 00:20:59,163 Uh, like, yeah, for the, like, for the relate, for the related entry. 400 00:20:59,164 --> 00:21:02,464 Right. So, like, so when you do, you know, you have implicit route model binding, 401 00:21:02,464 --> 00:21:02,704 -right? -Mm-hmm. 402 00:21:02,704 --> 00:21:07,603 So, like, it will, it will automatically pull the ID. You know, it says, "Here's 403 00:21:07,604 --> 00:21:08,844 -the ID." -Yep. 404 00:21:08,844 --> 00:21:13,864 Uh, "I'm going to go ahead and grab that particular type hinted model out of the 405 00:21:13,864 --> 00:21:16,204 -database," or "I'm gonna 404." -Mm-hmm. 406 00:21:16,204 --> 00:21:21,864 And then you use that in the policy to then check against, is this current, you 407 00:21:21,864 --> 00:21:25,884 know, is this current, uh, coaching entry? You know, you inspect it, basically, to 408 00:21:25,884 --> 00:21:29,383 determine if the person who's currently logged in can see that thing or not. 409 00:21:29,384 --> 00:21:31,084 -Yeah. -So my question is, does the authorize 410 00:21:31,084 --> 00:21:36,864 method have access to that particular model? So that when I'm saying, uh, this 411 00:21:36,864 --> 00:21:43,604 arrow authorize post class, comma, or- or just say, like, view, comma, and then I 412 00:21:43,604 --> 00:21:49,364 -pass in that particular post. -Yeah. Well, the- the route model binding 413 00:21:49,364 --> 00:21:50,324 stuff is done 414 00:21:51,084 --> 00:21:55,724 up the stack and then passed down into the request. So you do have access to the 415 00:21:55,724 --> 00:22:00,024 route and all of its bound parameters at that point. Yeah. 416 00:22:00,024 --> 00:22:03,624 So, yeah, like, in the controller, typically you have, like, the way that the 417 00:22:03,624 --> 00:22:07,913 implicit route model binding works is in the controller you have request, you know, 418 00:22:07,913 --> 00:22:10,544 type entered request, dollar sign request, comma- 419 00:22:10,544 --> 00:22:12,384 -Mm-hmm -... type entered coaching entry, dollar 420 00:22:12,384 --> 00:22:13,764 -sign coaching entry. -Mm-hmm. Yeah. 421 00:22:13,764 --> 00:22:14,324 -Right? -Yeah, yep. 422 00:22:14,324 --> 00:22:17,524 And then in the controller, you have access to that thing. So what I'm saying 423 00:22:17,524 --> 00:22:21,524 is I don't know how to get access to the coaching entry, dollar sign coaching 424 00:22:21,524 --> 00:22:23,794 entry, from the authorize method, 'cause I would need that- 425 00:22:23,794 --> 00:22:25,384 -Yeah, and- -... in order to be able to do my policy 426 00:22:25,384 --> 00:22:25,684 check. 427 00:22:26,424 --> 00:22:31,604 Yes. La- uh, so typ- previously, you'd have to do, like, this route and then pass 428 00:22:31,604 --> 00:22:33,564 -it the, the string name. -Mm-hmm. 429 00:22:33,644 --> 00:22:38,644 I think in Laravel 12, they introduced the thing so you can use an attribute to then 430 00:22:38,644 --> 00:22:44,043 bind that directly out of the route. So you can... I think it's pound square 431 00:22:44,043 --> 00:22:48,303 bracket route, and then give it the thing, and then you can actually inject a 432 00:22:48,304 --> 00:22:50,414 properly typed, um, 433 00:22:51,564 --> 00:22:55,704 class or instance there so that you will get the completion and you'll get all of 434 00:22:55,704 --> 00:22:59,724 that stuff there, and Laravel will then handle injecting that from the request 435 00:22:59,724 --> 00:23:02,984 -automatically. From- from the route- -Because doesn't that feel like... So if 436 00:23:02,984 --> 00:23:06,303 I'm just, I- I'm- I'm discovering the solution here with you. I'm talking it 437 00:23:06,304 --> 00:23:06,544 -through- -Mm-hmm 438 00:23:06,544 --> 00:23:09,224 ... because I'm interested in- in how it kinda does work. To me, it feels a little 439 00:23:09,224 --> 00:23:13,344 bit gross that, like, I have it type entered inside the controller. Like, and I 440 00:23:13,344 --> 00:23:16,604 know the name of it, I know the variable and all that stuff, but the form request 441 00:23:16,604 --> 00:23:18,183 -does not have that. -Mm-hmm. 442 00:23:18,184 --> 00:23:22,024 You know, it doesn't know. It doesn't have any idea of that route model binding 443 00:23:22,024 --> 00:23:24,344 thing. It doesn't know. And so 444 00:23:25,164 --> 00:23:30,704 it's like I have to either, you know, duplicate that inside of the form request 445 00:23:31,504 --> 00:23:35,664 or I have to somehow pass it in. I just, like, I'm wondering, you know, what is 446 00:23:35,664 --> 00:23:39,764 Team Laravel doing for this? Like, it seems like this is not 447 00:23:41,624 --> 00:23:44,944 how I- I would think that it would be done. Like, it just- 448 00:23:44,944 --> 00:23:47,084 -Yeah -... it seems too chaotic. I just, I'm 449 00:23:47,084 --> 00:23:50,864 like, "Who..." There- there's gotta be a way. There... Either there's, A, they're 450 00:23:50,864 --> 00:23:55,084 doing it a certain way that they're not super stoked with, um, and they're just 451 00:23:55,084 --> 00:23:59,384 sort of doing it. Or, B, they're doing it a different way that I'm completely 452 00:23:59,384 --> 00:24:00,584 unaware of. Or, 453 00:24:01,544 --> 00:24:04,764 C, I just don't like it and they don't give a crap. They don't care at all. 454 00:24:04,764 --> 00:24:06,524 -Mm-hmm. -It's fine. It's fine for them. You know 455 00:24:06,524 --> 00:24:10,524 -what I mean? -Yeah. Nuno, I think Nuno was posting 456 00:24:10,524 --> 00:24:15,904 something about this the other day. I saw a screenshot. So they're just calling 457 00:24:15,904 --> 00:24:21,164 request validate, um... Oh, no, this is the MCP Tools thing. I'm sure I saw that 458 00:24:21,164 --> 00:24:22,844 he tweeted somewhere. 459 00:24:24,444 --> 00:24:28,344 In Laravel MCP, tools, prompts, and resources share the same API request 460 00:24:28,344 --> 00:24:31,684 handle response. Similar to controllers in Laravel, you can validate input, dispatch 461 00:24:31,684 --> 00:24:36,934 actions, and more.But this is calling request validate, this is not talking 462 00:24:36,934 --> 00:24:37,964 about authorization. 463 00:24:38,914 --> 00:24:45,454 I'm, yeah, I'm, I'm certain in one of Nuno's, um, streams or videos that he 464 00:24:45,454 --> 00:24:49,293 posted, he did talk about how he goes through this. Which I assume would be very 465 00:24:49,293 --> 00:24:53,494 similar to how they're doing it, uh, in Laravel Cloud at the very least, 'cause he 466 00:24:53,494 --> 00:24:58,533 had a heavy hand in, in the architecture of that platform. So, um, it would 467 00:24:58,533 --> 00:25:00,454 definitely be good to, to gauge 468 00:25:01,154 --> 00:25:05,214 some... 'Cause I know that, you know, you brought this up in, uh, in Cash Money, 469 00:25:05,214 --> 00:25:06,674 -and, and David- -Yeah 470 00:25:06,674 --> 00:25:11,434 ... David Hemphill and I, we've, we're very much aligned in this in terms of, um, 471 00:25:11,434 --> 00:25:13,734 you know, using form requests for everything, and, and handling 472 00:25:13,734 --> 00:25:16,674 -authorization that way, so... -So, so- 473 00:25:16,674 --> 00:25:18,053 -I think- -Like- 474 00:25:18,053 --> 00:25:20,954 ... I think this is where it kinda comes down to, you know, there are many 475 00:25:20,954 --> 00:25:24,474 different ways of doing these things in Laravel, and it, and it varies case by 476 00:25:24,474 --> 00:25:29,394 case, app by app. Um, you know, some things make sense in some context that are 477 00:25:29,394 --> 00:25:34,114 different in others. Uh, and it's hard to find, like, the one prescribed way of 478 00:25:34,154 --> 00:25:35,314 -doing it. -Yeah. 479 00:25:35,314 --> 00:25:38,374 -Um, but yeah, I know- -I just, I just wanna be consistent, and it 480 00:25:38,374 --> 00:25:39,613 -just- -Yeah. 481 00:25:39,614 --> 00:25:43,033 Every time I feel like I've got it nailed down, there's, like, some weird edge case 482 00:25:43,033 --> 00:25:44,043 -thing that's like, "Oh-" -Mm-hmm. 483 00:25:44,043 --> 00:25:46,594 "... except for that, then you have to do it a different way." And I'm like, "No-" 484 00:25:46,594 --> 00:25:47,894 -Yeah. -"... dang it all, I don't wanna do it a 485 00:25:47,894 --> 00:25:48,984 -different way. I wanna do it-" -Yeah. 486 00:25:48,984 --> 00:25:53,293 "... the same way every time." Like, and it just feels like I can't find that way. 487 00:25:53,934 --> 00:25:56,994 I thought I had. I though- I did, I actually did have it. When I had that 488 00:25:56,994 --> 00:26:01,194 authorized resource thing, it was working perfectly. Now I, now it's, now I can't. 489 00:26:01,194 --> 00:26:02,043 -It's, it's- -Yeah, I mean, that's- 490 00:26:02,043 --> 00:26:03,334 -I'm screwed. -That's gone from 491 00:26:04,254 --> 00:26:07,574 the controller, because the base controller is gone, but you can still use 492 00:26:07,574 --> 00:26:10,293 the trait directly if you wanted to. You can, I mean, you can always bring that 493 00:26:10,293 --> 00:26:10,964 -base controller- -Well, no- 494 00:26:10,964 --> 00:26:13,063 -... back if you wanted to. -You can, but- 495 00:26:13,063 --> 00:26:16,754 -Or is it gone? -... you have to extend, like, if you do 496 00:26:16,754 --> 00:26:21,554 that, the, the, the way that they do the middle ware on the controllers is also 497 00:26:21,554 --> 00:26:22,664 -different now- -Right, okay 498 00:26:22,664 --> 00:26:25,813 ... because they've, they've removed that construct middle ware. 499 00:26:25,813 --> 00:26:28,374 -Yeah, 'cause it's a method now. -Yeah, they've con- removed that. And so 500 00:26:28,374 --> 00:26:31,674 you have to have, like, there's like a public static function middle ware on 501 00:26:31,674 --> 00:26:37,313 every controller, but the authorized resource uses that middle ware the way 502 00:26:37,313 --> 00:26:39,614 that it was previously written. Which is why I think- 503 00:26:39,614 --> 00:26:40,714 -Mm-hmm -... they removed it from the docs. It was 504 00:26:40,714 --> 00:26:43,094 like, "No, we're not gonna do this anymore." Like, you have to extend- 505 00:26:43,094 --> 00:26:47,174 -Mm-hmm -... a different type of, um... I- I looked 506 00:26:47,174 --> 00:26:49,734 into it. It's just, you have to do something funky. It's definitely not the 507 00:26:49,734 --> 00:26:52,813 direction the framework was going. Which I'm fine with saying we're gonna stick 508 00:26:52,813 --> 00:26:56,914 with where the c- the framework was going. I'm fine with changing, I just don't feel 509 00:26:56,914 --> 00:26:59,894 like I have a clear picture of, like, how it is. And, and again- 510 00:26:59,894 --> 00:27:02,313 -Mm-hmm -... maybe it's... They are just like, "No, 511 00:27:02,313 --> 00:27:06,014 no, no, there is a clear picture. The clear picture is do a gate authorize check 512 00:27:06,014 --> 00:27:09,474 in every single controller method." And I'm just like, "Ick, I don't like that. 513 00:27:09,474 --> 00:27:12,374 -That's still the thing." Um- -Yeah. 514 00:27:12,374 --> 00:27:15,274 -And so, you know. -I found, I found Nuno's, uh, tweet about 515 00:27:15,274 --> 00:27:18,914 it. It was from the 29th of January. So some things just stick in my head better 516 00:27:18,914 --> 00:27:22,313 than others. But he said, "Yes, authorization on my form request. I 517 00:27:22,313 --> 00:27:27,414 typically test form request on my controller test." So the... I- I've linked 518 00:27:27,414 --> 00:27:29,654 it to you, I have a link for you in the show notes. Basically he's got a 519 00:27:29,654 --> 00:27:33,254 controller which has a method that injects the request, and the assumption is that 520 00:27:33,254 --> 00:27:36,734 the authorization has already happened in the request, and the validation obviously 521 00:27:36,734 --> 00:27:41,574 then happens in the, uh, form request implicitly. And then it's just a matter of 522 00:27:41,574 --> 00:27:45,734 calling the action handle method and returning response from the controller, 523 00:27:45,734 --> 00:27:47,774 -and- -Okay, so here's, here's my only, this is 524 00:27:47,774 --> 00:27:50,894 my only hang up, right? And you may have an answer to this, you may not. 525 00:27:52,674 --> 00:27:53,414 If I have 526 00:27:54,894 --> 00:27:55,074 a 527 00:27:56,754 --> 00:27:57,063 item. 528 00:27:58,154 --> 00:28:01,394 If I'm edit, like, so if I'm editing an item, okay? 529 00:28:01,394 --> 00:28:03,934 -Mm-hmm. Mm-hmm. -And I am getting that through the 530 00:28:03,934 --> 00:28:09,013 controller method, um, not store, not like a new one, like I'm- 531 00:28:09,014 --> 00:28:10,634 -Mm-hmm -... editing or I'm viewing one that 532 00:28:10,634 --> 00:28:12,874 -already exists. -Mm-hmm. 533 00:28:12,874 --> 00:28:17,554 How can I reference that item that's coming in in my form request 534 00:28:18,174 --> 00:28:21,334 in the authorize method? That's it. If I could figure that out, I feel like I'm 535 00:28:21,334 --> 00:28:21,654 good. 536 00:28:22,894 --> 00:28:25,813 And I'm, I want that to be actually a good answer. Like, I don't want it to be some 537 00:28:25,813 --> 00:28:29,054 janky, like, I have to pull it from the route thing. Like, I want it to, like... 538 00:28:29,054 --> 00:28:32,554 Yeah. Well this is the, the route parameter attribute that you would, you 539 00:28:32,554 --> 00:28:32,714 would 540 00:28:33,394 --> 00:28:33,854 hint that 541 00:28:34,533 --> 00:28:38,293 in that authorize method, and it should inject it for you that way. 542 00:28:39,274 --> 00:28:41,014 -Okay. -That's how I believe it's meant to work, 543 00:28:41,014 --> 00:28:42,834 so. 544 00:28:44,354 --> 00:28:47,634 Storage, keep that route parameter attribute. Yeah. 545 00:28:47,634 --> 00:28:52,994 Yeah. Yeah, and I'd say the only piece to me that still feels incomplete on that is 546 00:28:52,994 --> 00:28:57,994 that I have to have that in both my controller and my form request, that same 547 00:28:57,994 --> 00:29:02,174 variable. I have to keep it in. I have to keep it consistent. It, my refactor tools 548 00:29:02,174 --> 00:29:05,994 are not gonna know that those are gonna need to change together. 549 00:29:05,994 --> 00:29:09,313 No. They won't. Um, 550 00:29:10,793 --> 00:29:11,174 no. 551 00:29:12,174 --> 00:29:15,974 But you, you need... Well, yeah, you need to put them in both places anyway 552 00:29:17,094 --> 00:29:20,134 if you need both of them to be aware of it. It's, like, it's no different than 553 00:29:20,134 --> 00:29:24,494 passing it down into an action or sending it somewhere else. Like, those things just 554 00:29:24,494 --> 00:29:26,994 -need to know about it. -Well, except for from there, I'm passing 555 00:29:26,994 --> 00:29:30,214 -it from the controller into the action. -Mm-hmm. Mm-hmm. 556 00:29:30,214 --> 00:29:33,144 Right? And so I can see it in the controller. It's like it's right there. 557 00:29:33,144 --> 00:29:34,894 -Yeah, yeah. -I can see the name of the variable. I know 558 00:29:34,894 --> 00:29:37,413 I have that available to me in the controller. 559 00:29:37,414 --> 00:29:39,414 -Mm-hmm. -And so then I just... And it's no problem. 560 00:29:39,414 --> 00:29:41,793 -I- I just, it's like it's- -I mean, if you wanted to 561 00:29:42,534 --> 00:29:46,014 if you wanted to, you could then, you could then type the route parameter in 562 00:29:46,014 --> 00:29:48,854 both of them rather than relying on the implicit injection 563 00:29:51,354 --> 00:29:53,434 -into the controller. -Could I do, could I... 564 00:29:53,434 --> 00:29:55,394 -So rather than just- -Go ahead. 565 00:29:55,394 --> 00:29:59,614 Yeah, so rather than in your controller method doing, you know, binding the, the 566 00:29:59,614 --> 00:30:03,813 model directly, you could just say route parameter. 'Cause this, you can- 567 00:30:03,813 --> 00:30:05,914 -Ah, okay -... that route parameter attribute 568 00:30:06,614 --> 00:30:11,974 is, a- an attribute that targets parameters. So you could do it on a, on a 569 00:30:11,974 --> 00:30:13,744 controller's edit method, yeah. 570 00:30:14,614 --> 00:30:16,874 -Mm-hmm. -But, you know, without running the code, 571 00:30:16,874 --> 00:30:20,313 looking at it, it certainly seems to, to be the case. 572 00:30:21,254 --> 00:30:24,054 Okay. I need to find the documentation for that, 573 00:30:24,813 --> 00:30:27,444 for what you're talking about. Is it an attribute, that route attribute? 574 00:30:27,444 --> 00:30:31,313 Contextual, yeah, contextual, contextual attributes, I think is what they're called 575 00:30:31,313 --> 00:30:34,994 -in the documentation. -Okay. Let's look that up. 576 00:30:34,994 --> 00:30:39,534 Contextual attributes, yeah, as part of the service container documentation. 577 00:30:42,902 --> 00:30:44,002 Contextual attributes. 578 00:30:44,862 --> 00:30:49,742 Route parameter, and then so you say, like, the route parameter would be, uh, 579 00:30:49,742 --> 00:30:51,402 -coaching- -Yeah 580 00:30:51,402 --> 00:30:55,332 ... as a string, and then you would have a, you know, coaching, 581 00:30:56,102 --> 00:31:01,182 dollar coaching, you know, and put it put it in the definition that way. 582 00:31:01,182 --> 00:31:06,522 I'm curious if when I get it that way, if it's actually going to give me is is it 583 00:31:06,522 --> 00:31:10,121 just going to give me the value, the ID that's being passed through? So I have to 584 00:31:10,122 --> 00:31:12,462 -look it up again? -It'll it'll do the casting for you. 585 00:31:12,462 --> 00:31:15,742 -It will do that. -It's basically an explicit model 586 00:31:16,422 --> 00:31:18,002 binding. 587 00:31:18,762 --> 00:31:25,322 Right? You're saying take this thing explicitly from the route, right, the the 588 00:31:25,322 --> 00:31:26,362 ID of the coaching 589 00:31:27,002 --> 00:31:30,942 model, and then Mhmm. It will handle casting that into a coaching 590 00:31:30,942 --> 00:31:33,622 -Oh, I see it -... model. 591 00:31:33,622 --> 00:31:36,302 Mhmm. Mhmm. Mhmm. Yep. 592 00:31:37,182 --> 00:31:42,142 And it does a container make from the request and gets that route parameter, and 593 00:31:42,142 --> 00:31:47,902 then you get that back because it's an attribute that you have now typed as a as 594 00:31:47,902 --> 00:31:53,862 a, method parameter, you'll get the type of that thing knowing that it is an 595 00:31:53,862 --> 00:31:57,562 instance of whatever it should be out of the route, which in this case 596 00:31:57,562 --> 00:32:02,072 Interesting. So I could do that I could do that inside of the, um, 597 00:32:02,942 --> 00:32:05,172 -the form request? -The form request and the controller. Yeah. 598 00:32:05,172 --> 00:32:10,152 I mean, it it doesn't stop the like, I've gotta put it in two places. But it makes 599 00:32:10,152 --> 00:32:12,202 -it -Yeah. Or maybe or maybe it actually I 600 00:32:12,202 --> 00:32:16,222 wonder if it actually also, makes 2 queries. 601 00:32:16,222 --> 00:32:20,322 -That would be the thing to check for. -Hmm. 602 00:32:20,322 --> 00:32:22,802 I mean, it's pulling it out of the route. So it's set 603 00:32:23,542 --> 00:32:26,222 -on the route there. -Yeah. 604 00:32:26,942 --> 00:32:27,822 -Yeah. -So 605 00:32:28,922 --> 00:32:31,112 worth exploring. Uh, I wouldn't go and refactor my 606 00:32:31,112 --> 00:32:35,082 I'm still not super yeah. Well so that's where we're at. It's like we're already 607 00:32:35,082 --> 00:32:38,022 going through the process of refactoring the code base. So I'm pulling my hair out 608 00:32:38,022 --> 00:32:42,022 trying to figure out, okay, we're doing this once. How do we wanna do it? And I 609 00:32:42,022 --> 00:32:44,602 just don't feel like I have a good answer. So 610 00:32:45,422 --> 00:32:47,602 -Yeah. There are -I might just end up I might just so what I 611 00:32:47,602 --> 00:32:53,662 know what I know I can do is the the easy way that's ugly is just do the gate 612 00:32:53,662 --> 00:32:56,382 authorize check at the top of every controller method and call it good. And it 613 00:32:56,422 --> 00:32:59,342 is it is ugly, but it's effective, and it works every time. Like 614 00:33:00,782 --> 00:33:03,442 -Yeah. -I mean, there are there are some ugly 615 00:33:03,442 --> 00:33:07,142 things, and there are some paper cuts in the framework that I don't know that there 616 00:33:07,142 --> 00:33:09,642 are good solutions for. Um, 617 00:33:10,702 --> 00:33:14,842 and, like, I know that Taylor likes to go through and find these paper cuts and and 618 00:33:14,842 --> 00:33:19,802 clean them up, but there are just some things that I think can't be cleaned up. I 619 00:33:19,802 --> 00:33:22,902 mean, I say that now, maybe in 6 months, he will, you know he will have one of 620 00:33:22,902 --> 00:33:28,421 those light bulb moments and figure out how to do it. But, um, yeah, the the form 621 00:33:28,422 --> 00:33:31,662 request and the controller kind of different context as well. 622 00:33:31,662 --> 00:33:33,492 -Yeah. Yeah. -Even though they're coupled. Um, 623 00:33:34,382 --> 00:33:38,662 -yeah. -Yep. Yep. Yep. Yep. Okay. 624 00:33:38,662 --> 00:33:41,942 Interesting. I'd be interested to to hear where you land on it though. 625 00:33:41,942 --> 00:33:47,122 Yeah. I think I think if I'm if I'm just trying to be, like if I'm trying to be as 626 00:33:47,122 --> 00:33:52,042 consistent and as, like, pragmatic as I would as I could be, I think, ideally, I 627 00:33:52,042 --> 00:33:55,442 would like to put it in the form request. I would like to just always have a form 628 00:33:55,442 --> 00:34:00,002 request object, always have an authorized method, and always be checking the policy 629 00:34:00,002 --> 00:34:01,782 -in that spot. -Yeah. 630 00:34:01,782 --> 00:34:05,242 Um, and then I think the trick the only trick I have to figure out is how I can 631 00:34:05,242 --> 00:34:11,402 make sure that I have access to that that, um, model that is bound, you know, the 632 00:34:11,402 --> 00:34:14,662 implicit binding. And if I can figure that out, then I'm I'm good to go. And I'll 633 00:34:14,662 --> 00:34:16,701 I'll let you know kinda where we where we land on that. 634 00:34:16,702 --> 00:34:19,902 -Yeah. Excellent. -Cool. 635 00:34:19,902 --> 00:34:23,362 -It's nice. -Okay. Yes. Yes. Yes. Alright. We are what 636 00:34:23,362 --> 00:34:26,002 -time are we at here? 34? -Yeah. 637 00:34:26,002 --> 00:34:29,752 Alright. We got we we got anything else before wanna talk about before we go or 638 00:34:29,752 --> 00:34:30,110 are we good? 639 00:34:31,722 --> 00:34:35,482 Uh, no. I mean, we talked about the Salesforce mocking thing, uh, last 640 00:34:35,482 --> 00:34:40,642 episode, which I'm still working my way through because I realized today that at 641 00:34:40,642 --> 00:34:45,201 some point during the AI writing the code, it deleted a whole bunch of code that I 642 00:34:45,202 --> 00:34:47,822 -Oh, fun. -... still had written. So and I'm not sure 643 00:34:47,822 --> 00:34:51,182 like, I don't know if I'd stashed it and then dropped the stash because I thought I 644 00:34:51,182 --> 00:34:55,942 wasn't working on that anymore. Um, but it likes to be very verbose. And so 645 00:34:56,622 --> 00:34:58,542 what I have found through this process 646 00:34:59,182 --> 00:34:59,682 is that 647 00:35:00,342 --> 00:35:03,502 a lot of stuff you end up doing multiple times because you'd like you get the first 648 00:35:03,502 --> 00:35:07,362 cut and then you have to like tidy it up and then it like starts doing weird 649 00:35:07,362 --> 00:35:12,282 things. Like I said, I want you to bind a faker instance to the container. So it 650 00:35:12,282 --> 00:35:13,602 went and actually bound 651 00:35:14,542 --> 00:35:17,922 well, I said I wanted to choose dependency and injection. And so I went and then 652 00:35:17,922 --> 00:35:21,642 bound an instance of faker to the container rather than just injecting it as 653 00:35:21,642 --> 00:35:22,682 a constructor 654 00:35:23,742 --> 00:35:28,362 property. So this is things like that. I'm I'm getting to the point where I'm, like, 655 00:35:28,362 --> 00:35:32,202 I would just do this myself. Like, you have given me enough of the skeleton that 656 00:35:32,202 --> 00:35:35,602 I can go and make the rest of this work. Otherwise, I'm just gonna keep going round 657 00:35:35,602 --> 00:35:36,482 and round in circles. 658 00:35:37,622 --> 00:35:37,922 So 659 00:35:38,882 --> 00:35:43,762 I did find though, um, I'm using I think we spoke about open code last time. I'm 660 00:35:43,762 --> 00:35:50,182 using that. They're offering brock code fast for free for a period of time while 661 00:35:50,182 --> 00:35:53,602 they're testing it out with with their stuff. And I think 662 00:35:54,222 --> 00:35:59,562 it tends to produce results, like, good enough results much quicker because it 663 00:35:59,562 --> 00:35:59,982 doesn't 664 00:36:00,742 --> 00:36:04,322 spit out all of the, like, thought process that it's going through where Claude 665 00:36:04,962 --> 00:36:09,402 and the Sonnet model will say, you know, I'm doing this. I'm looking at this. Oh, 666 00:36:09,402 --> 00:36:13,502 this didn't work. I'm gonna, like, go and investigate this. Whatever. Like, it's 667 00:36:13,502 --> 00:36:18,502 very verbose in terms of describing what it's doing. Brock code seems to just, 668 00:36:18,502 --> 00:36:22,362 like, do it and then go here's the result at the end, which 669 00:36:23,002 --> 00:36:24,582 depending on who you are 670 00:36:25,302 --> 00:36:26,022 may or may not be 671 00:36:26,722 --> 00:36:30,922 a better option. But I found towards the end of last week that 672 00:36:31,882 --> 00:36:33,962 that Groq code was 673 00:36:34,842 --> 00:36:39,001 certainly producing results much quicker where Sonnet kept on timing out. But I 674 00:36:39,002 --> 00:36:42,342 think Claude had some issues last week, and they made some tweaks to their models 675 00:36:42,342 --> 00:36:45,742 or something like that. So maybe that came into play because it seems to be working 676 00:36:45,742 --> 00:36:52,714 okay again today.So, anyway, I don't know. I think our code base is, is 677 00:36:52,714 --> 00:36:57,174 quite large and some of the stuff that's in there may impair 678 00:36:57,934 --> 00:37:00,424 -more than impact what it's doing. -Mm-hmm. 679 00:37:00,424 --> 00:37:05,474 And so, yeah. It certainly has gotten through a lot of the boilerplate and a lot 680 00:37:05,474 --> 00:37:09,134 of the things that I wouldn't wanna do, like, you know, coming up with mock 681 00:37:09,134 --> 00:37:13,294 responses for Salesforce requests. Like, it's figured out what they should look 682 00:37:13,294 --> 00:37:13,774 like and 683 00:37:14,394 --> 00:37:18,454 the shape of the responses and generating all of the, the bodies. So it's been very 684 00:37:18,454 --> 00:37:21,954 good at that. But in terms of tying all the pieces together, I'm not stoked with 685 00:37:21,954 --> 00:37:23,454 -it, to be honest. -Yeah. 686 00:37:23,454 --> 00:37:26,734 You know, whether, whether or not that's, like, the model is not capable of it or 687 00:37:26,734 --> 00:37:29,874 I'm not capable of steering the model at this stage is 688 00:37:30,594 --> 00:37:35,134 unclear. But it's just a frustrating thing, and it's, it's turning into a bit 689 00:37:35,134 --> 00:37:38,654 of an abusive relationship now because every time I say- ... "Nah, this is crap. 690 00:37:38,654 --> 00:37:41,894 I'm not gonna use this anymore. I'm gonna do it myself," I find my way back to it 691 00:37:41,894 --> 00:37:45,834 and try again anyway. Maybe this time it'll be different, so. 692 00:37:45,834 --> 00:37:49,634 -You get... You're codependent. -It's no, it's no good. But I feel- 693 00:37:49,634 --> 00:37:50,734 -There's- -I, I just, I 694 00:37:51,454 --> 00:37:52,614 -there's- -There's gonna be a whole industry popping 695 00:37:52,614 --> 00:37:55,814 up around, like, AI, like, relationship coaching. 696 00:37:55,814 --> 00:38:00,534 Yeah. Yeah. There's, uh, we'll, we'll probably wrap on this, and maybe I'll get 697 00:38:00,534 --> 00:38:02,674 your opinion on it and then we can wrap. But 698 00:38:03,394 --> 00:38:05,374 I feel like there's a big push 699 00:38:06,574 --> 00:38:09,714 as an industry. Like, you see it all the time. Companies are saying, "You've gotta 700 00:38:09,714 --> 00:38:12,894 use AI. We're not hiring any more staff unless you can show that you've exhausted 701 00:38:12,894 --> 00:38:16,994 all avenues with AI," and, and whatever else. Like, so there's that whole school 702 00:38:16,994 --> 00:38:20,744 of thought going on. And, um, 703 00:38:22,114 --> 00:38:27,014 I feel like as engineers, as developers that have been in the game for a long 704 00:38:27,014 --> 00:38:30,894 period of time, that have, like, done all of the work by hand for a long period of 705 00:38:30,894 --> 00:38:34,814 time, sitting there and watching the computer write the code for you, it's 706 00:38:34,814 --> 00:38:36,814 like, what am I being paid for now 707 00:38:37,674 --> 00:38:41,414 to, like, sit there and just what? Like, I feel very dirty about it. Whereas some 708 00:38:41,414 --> 00:38:45,594 people are like, "This is great. I can get more done," I don't feel like it's made 709 00:38:45,594 --> 00:38:49,454 me quicker. I feel like it has certainly written more code than I could have over 710 00:38:49,454 --> 00:38:54,394 the same period of time. I don't think it's produced the same amount of output 711 00:38:54,394 --> 00:38:57,854 and the same amount of value as I could in that same amount of time, if that makes 712 00:38:57,854 --> 00:38:59,384 -sense. -Mm. Yeah, so do you- 713 00:38:59,384 --> 00:39:01,014 -Um- -You feel like it's actually made, made you 714 00:39:01,014 --> 00:39:04,533 less efficient, but it's, it's easier for you? 715 00:39:04,534 --> 00:39:06,854 -I don't think it's made me more- -Less produc- not, not less efficient, less 716 00:39:06,854 --> 00:39:07,854 -productive? -Yeah. 717 00:39:07,854 --> 00:39:11,554 -Do you feel like you're producing less? -Yeah, I feel like... Yeah, 'cause, like, 718 00:39:11,554 --> 00:39:14,003 I'm not doing it. I'm watching the computer do it, right? 719 00:39:14,003 --> 00:39:16,014 -Sure. -But I feel like what it's producing, I 720 00:39:16,014 --> 00:39:20,494 still need to go over, and there's a lot of untangling going on there. So I'm, I'm 721 00:39:20,494 --> 00:39:25,054 watching the computer write the code for, you know, hours of a day 722 00:39:25,674 --> 00:39:31,394 or across a week, you know, hours of, of, of that week. And it's like, well, what, 723 00:39:31,394 --> 00:39:32,814 what am I supposed to be doing while it's 724 00:39:33,834 --> 00:39:36,674 churning out code? And then, oh, it's finished. Okay, now I've gotta go and look 725 00:39:36,674 --> 00:39:40,394 at it. No, that's no good. Figure out how we're gonna fix it. Okay, then off it 726 00:39:40,394 --> 00:39:45,554 goes again. It's like... I don't know. As, as someone who has always written the 727 00:39:45,554 --> 00:39:50,694 code, it's like, I understand that I get, you know, you get paid to do the work, but 728 00:39:50,694 --> 00:39:53,874 now I'm not doing the work, if that makes sense. So what- 729 00:39:53,874 --> 00:39:54,563 -Yeah, yeah -... what, what am I, what am I being paid 730 00:39:54,563 --> 00:39:56,454 -for here? -Are you, are you using, are you using it 731 00:39:56,454 --> 00:39:58,894 in, like, planning mode first to kinda get it all set up? 732 00:39:58,894 --> 00:40:00,054 -Yeah. -And then you... Yeah. Okay. 733 00:40:00,054 --> 00:40:01,494 -Yeah. -So you're doing it that way. Okay. Yeah. 734 00:40:01,494 --> 00:40:03,474 -Yeah. -I don't know, dude. I, honestly, I wish I 735 00:40:03,474 --> 00:40:07,614 could tell you. I feel like tomorrow I actually told Andy Hinkle. I was like, 736 00:40:07,614 --> 00:40:10,194 "Dude, you're gonna do a Teaching Tuesday for us tomorrow, and you're gonna show us 737 00:40:10,194 --> 00:40:12,234 how you actually go through 738 00:40:12,294 --> 00:40:17,114 with Claude and with, uh, Cursor and, and how you actually go through. What's your 739 00:40:17,114 --> 00:40:20,474 process, you know? Um, how do you set it up in planning mode? What are the things 740 00:40:20,474 --> 00:40:22,834 that you're prompting it with?" And whatever. And there, there are little 741 00:40:22,834 --> 00:40:28,574 things. Like, so today he went through and was like, "Here are all the strings that 742 00:40:28,574 --> 00:40:33,654 I want to have a passing test for, that it should have this output. And here are all 743 00:40:33,654 --> 00:40:37,834 the ones that I have strings that should be ignored, and this is what it should 744 00:40:37,834 --> 00:40:38,804 -be," whatever. And then he said- -Mm-hmm 745 00:40:38,804 --> 00:40:42,294 ... "I need a regex that solves all of these." And it was like, "Okay. Let me 746 00:40:42,294 --> 00:40:44,954 wri- let me do this." And he's like, "No, no, no. Start with TDD first. Like, write 747 00:40:44,954 --> 00:40:47,674 the test." It was like, "Okay, I'll write the test." Then he's like, "Okay. Now 748 00:40:47,674 --> 00:40:51,344 write your regex." And it wrote a single regex that solved all of those, and it 749 00:40:51,344 --> 00:40:51,624 -passed- -Mm-hmm 750 00:40:51,624 --> 00:40:53,034 -... all the tests. And it's like, okay. -Yeah. 751 00:40:53,034 --> 00:40:57,644 Pretty sweet. Like, 'cause Andy's... He's, he's good with... You know, he... I don't 752 00:40:57,644 --> 00:41:01,934 think he's ever had to use or, like, had to know exactly what the regex was. Most 753 00:41:01,934 --> 00:41:04,574 of the time, you can just kinda, like, Google it, and like, "Okay, I need a regex 754 00:41:04,574 --> 00:41:05,293 -for a phone number." -Yeah. Yeah. 755 00:41:05,294 --> 00:41:07,204 Great. There we go. You know, I don't know what it means, but whatever. 756 00:41:07,204 --> 00:41:10,814 -He's very good at writing regexes. Yeah. -Totally. And, like, I love regex stuff. 757 00:41:10,814 --> 00:41:13,514 And so, like, for me, it's very interesting to kinda see him pull it apart 758 00:41:13,514 --> 00:41:17,194 and whatever. But it's like, does it really necessary for him to learn all 759 00:41:17,194 --> 00:41:19,414 that, or can he just prompt the AI to do that? And so it's like- 760 00:41:19,414 --> 00:41:20,514 -Yeah -... there are instances where it's, like, 761 00:41:20,514 --> 00:41:22,394 -very useful for that sort of stuff. So- -Mm-hmm. 762 00:41:22,394 --> 00:41:25,454 And it was stupid, it would be stupid for him to write that code because s- you 763 00:41:25,454 --> 00:41:27,354 -know, it can write it for him. And so- -Yeah. 764 00:41:27,354 --> 00:41:29,514 -Um, yeah. I don't know. -For those kinds of things, like, I have 765 00:41:29,514 --> 00:41:33,734 definitely found that it's, it's quite good at it. Um, especially, you know, when 766 00:41:33,734 --> 00:41:35,804 we've been wanting to figure out... Like, we have 767 00:41:36,814 --> 00:41:38,234 in the Salesforce library 768 00:41:39,294 --> 00:41:45,174 every- everything that, like, runs a raw query against the Salesforce endpoint, it 769 00:41:45,174 --> 00:41:50,474 just sends an execute query request. So it could be a, it could doing a select from 770 00:41:50,474 --> 00:41:54,614 contacts or accounts or, you know, whatever else. So the only way to kinda 771 00:41:54,614 --> 00:41:58,274 figure out what kind of request is actually being sent in order for us to be 772 00:41:58,274 --> 00:42:04,194 able to then fake the response is to inspect the query string. Um, and so, 773 00:42:04,194 --> 00:42:05,354 like, it's kinda figured out 774 00:42:06,094 --> 00:42:09,174 initially that it, it was writing a regex. I'm like, "I think this is a bit 775 00:42:09,174 --> 00:42:13,394 overkill," 'cause I was looking at this regex. I'm like that, that looks very 776 00:42:13,394 --> 00:42:17,494 complicated. Uh, let's maybe just use a string contains here and just look for, 777 00:42:17,494 --> 00:42:21,734 like, if the query string contains from account, it means that we're doing an 778 00:42:21,734 --> 00:42:24,754 account lookup so we can return the account if it... You know, all of that 779 00:42:24,754 --> 00:42:25,514 kinda stuff. But 780 00:42:26,514 --> 00:42:30,494 it's... Yeah. There, there are things... I haven't formulated a concrete opinion on 781 00:42:30,494 --> 00:42:33,894 it yet. There are certainly things that it can do and does well. Like, I love using 782 00:42:33,894 --> 00:42:37,024 -it to go and fix PHP stand violations. -Mm. 783 00:42:37,024 --> 00:42:39,214 'Cause it's like, ah, I don't wanna go through that. Um- 784 00:42:39,214 --> 00:42:41,814 -Yeah -... especially when you update a, a patch 785 00:42:41,814 --> 00:42:44,554 release and end up with 90 or whatever 786 00:42:45,314 --> 00:42:49,004 stand violations that weren't there before the update, like I did yesterday. 787 00:42:50,634 --> 00:42:56,986 Um...... but, uh, yeah. There are also things that, even guided, like, "Okay. I 788 00:42:56,986 --> 00:43:01,025 want a- I want you to create a- a registry of these things." Or "I want it..." You 789 00:43:01,026 --> 00:43:05,806 know, if you- if you're very specific and very guided, um, it can go and generate a 790 00:43:05,806 --> 00:43:10,065 lot of code. But then you've gotta go and look at it, because, um, it doesn't do 791 00:43:10,066 --> 00:43:14,266 things quite as well as I would hope for code that I want to ship into production. 792 00:43:14,266 --> 00:43:20,186 Because, yeah, the AI may have written it, but then I have to support it. So... 793 00:43:20,186 --> 00:43:24,026 That's the main thing. Like, you do still need to understand it in, you know, in a 794 00:43:24,026 --> 00:43:25,686 -professional capacity. -Yeah. 795 00:43:25,686 --> 00:43:29,726 Like, if you're- if you're a non-programmer and you're just trying to 796 00:43:29,726 --> 00:43:33,466 bring your ideas to life... I spoke to a friend the other day who's a- a UX 797 00:43:33,466 --> 00:43:36,586 researcher, and he built this thing, um, 798 00:43:37,366 --> 00:43:38,025 that does 799 00:43:39,006 --> 00:43:41,946 some analysis. I don't wanna go too much into it, 'cause he's still building it 800 00:43:41,946 --> 00:43:47,746 out. But he built this as, like, a- a next app, um, and, like, all of his stuff, it- 801 00:43:47,746 --> 00:43:51,256 it does all the analysis, it provides reports, it shows you all these different 802 00:43:51,256 --> 00:43:57,886 things, that over the last month and a half, two months, he's built himself. Um, 803 00:43:57,886 --> 00:44:01,226 because he knows, like, what comes out the other side of it, he knows what he's 804 00:44:01,226 --> 00:44:06,986 expecting there. But if you looked under the- under the hood of all of that code, 805 00:44:06,986 --> 00:44:10,866 it's not gonna be something that you'd wanna maintain. For that use case- 806 00:44:10,866 --> 00:44:12,086 -Yeah -... where you're building something that 807 00:44:12,086 --> 00:44:14,036 -you would not have otherwise had- -It's... Yeah. You could toss- 808 00:44:14,036 --> 00:44:15,076 -... the time, the capability- -Yeah 809 00:44:15,076 --> 00:44:19,286 ... the money to- to do, you know, it doesn't matter. But he's pro- providing 810 00:44:19,286 --> 00:44:22,546 -value in the outcomes. So... -Yeah. 811 00:44:22,546 --> 00:44:26,026 But as a software engi- uh, I keep saying engineer. As a software developer, I find 812 00:44:26,026 --> 00:44:30,436 myself endlessly frustrated by what it puts out, um, 813 00:44:31,566 --> 00:44:35,746 -and I'm- I'm not- not convinced by it. -Yeah. 814 00:44:36,666 --> 00:44:40,166 Yep. Like I said, it's just... It always... The answer is it depends, right? 815 00:44:40,166 --> 00:44:40,446 Yeah. 816 00:44:40,446 --> 00:44:41,906 -As with anything. -Yeah. 817 00:44:41,906 --> 00:44:47,566 As with anything. All right, my friends. Why don't we wrap it there? Uh, this is 818 00:44:47,566 --> 00:44:51,156 -gonna be Episode 183? -183. 819 00:44:51,156 --> 00:44:51,666 -183? -Mm-hmm. 820 00:44:51,666 --> 00:44:54,166 Thanks for hang- thanks for hanging out with us, folks. Find those show notes for 821 00:44:54,166 --> 00:44:59,886 this episode at northmeetsouth.audio/183. Hit us up on Twitter, on X, on Bluesky, 822 00:44:59,886 --> 00:45:04,006 @MichaelDurant, @JacobBennett, or at North South Audio. And if you liked the show, 823 00:45:04,006 --> 00:45:07,366 rate it up in your podcatcher of choice. Five stars would be incredible. Thanks, 824 00:45:07,366 --> 00:45:11,966 -folks. Until next time. We'll see ya. -Bye.

Never lose your place, on any device

Create a free account to sync, back up, and get personal recommendations.