Generic Eloquent, resize observers, and mastering query scopes
Download MP3This is the Larabell News podcast, your one stop podcast to find out about Laravel related news, tutorials, packages, and more. Here are your hosts, Jake Bennett and Michael
Jake:Hello. Hello. And Heidi ho to everyone out there. Today is July 16th, and this is episode 219 of the Laravel News podcast. Thank you for tuning in, and apologies for my voice.
Jake:I am currently in Ohio right now, and I forgot to introduce Michael. Michael, my amazing friend and wonderful cohost, mister Michael Dyrynda. That's right. Michael, how's it going? And I'll tell you about I'll tell you about my voice.
Jake:Sorry.
Michael:You you you just take this episode. I'll sit this one out by the sound of the
Jake:I'm sorry. I'm so sorry. I was just as I was introing things, I was, like, recognizing my voice was so terrible that I was, like, wait a second. So, anyway, sorry about that. Michael, how are you, my friend?
Michael:I'm alright. I'm alright. Yeah. It's ticking along.
Jake:You're shooting back to back here. You're you're staying busy today.
Michael:Busy busy. Yeah. Well, I was trying to spread things out over a couple of days, and then you were traveling yesterday. So we had to push yesterday to today, and then I was going to record tomorrow, but I'm going into the office tomorrow. So I've kind of had to stack things up back to back.
Michael:So
Jake:Okay. Gotcha.
Michael:Going well.
Jake:Good. Good. Yeah. So I'm out of town right now, which is the explanation for my different surroundings here. I'm actually just in a, like, random bedroom in my in law's house trying to knock this thing out.
Jake:It's, 11:20, and all the kids are getting ready to go to sleep. So trying to trying to get this thing going, but we've been at, an amusement park for the last 2 days, Cedar Point, for those of you who are familiar, and it's incredible. I used to go here all the time when I was a kid, and so I get to go 2 days in a row last year, 2 days in a row this year, and, got to ride all the roller coasters I wanted to, which was super fun, but my voice is completely shot because it's you're not riding a roller coaster unless you're screaming while you're doing it. So, I had a really good time, but, yeah, my voice is a little bit, a little bit worse for the wear, you know.
Michael:That's alright. We'll we'll we'll we'll make it through.
Jake:We will indeed. Hey. We wanna give a quick shout out to Honey Badger who is our sponsor today. Thanks again. Honey Badger has been, a sponsor before, and we wanted to give them a quick shout out for doing so.
Jake:Again, we're gonna be talking about them a little bit later in the show, talking about this new product they're releasing called Honey Badger Insights. Excited to talk about that one. But for now, let's get into the news. We are on Laravel 11 dot 14, the newest, one of the newest releases that we have. This is gonna cover both 11/13 and 11/14.
Jake:In this release, we have new string methods, like chop start, chop end. We have common mark extension support with Laravel's string markdown method and a number pairs method. So let's start with those string helpers. Tim McDonald, TMAC, as he's called, contributed to we're gonna make that happen. We're making it happen even if it he doesn't want to.
Jake:It's t Mac. So, they contributed 2 string methods for chopping characters off the beginning or the end of a string. So the chop start and chop end methods are available using the, fluent stringable class, or the STR helper. So you STR double colon chop end, and so you can pass in as your first argument there the string that you wanted to chop, and then as a second argument, whatever it is that you wanted to take off the end there. So if we had, like, a path to file dot PHP, you'd pass that as your first argument.
Jake:As the second argument, you do dot PHP and that would chop off the end there. You also can pass in an array. So chop start works the same, but in the second example that's being given here, the first the first string that's passed in is httpscolon/larville.com. And as a second argument, instead of just passing https, they're also passing HTTP because sometimes you don't know. Right?
Jake:So as the second argument, you can pass either a single string or you can pass an array of strings. And if any of those, strings are encountered that are in that second array there, it will chop them off at the start and, just leave you with the remaining string. So pretty helpful little utility there. Thanks, TMAC, to McDonald for, contributing that one. We also have support for extensions to the string markdown and the stringable class.
Jake:So Tony Lee contributed support for passing common mark extensions as a third parameter to the string markdown method. So the way that this works is str colon colon markdown, and then as the next argument you pass in your markdown contents, couple other pieces there. And then the 3rd parameter is any other common mark extensions, like the attributes extension or the task click list extension. And then, in 11/14, Luke Downing followed up Tony Lee's contribution by adding support for common mark extensions to the stringable class as well, not just for markdown, but to the stringable class as well. So you can say STR, pass in your, your markdown there, and then arrow markdown and then extensions, heading permalink extension, etcetera.
Jake:To be honest with you, I've heard of CommonMark before, but I don't I I can't talk, like, intelligently about it. Do you know what CommonMark extensions are, Michael?
Michael:I mean, CommonMark is is just like a superset or a subset of markdown where there was this when when John Gruber created markdown, he was like, yeah, here's some stuff. And the Internet did what the Internet does and tried to standardize it. And so CommonMark was one of those attempts at standardizing. I think it's, you know, one of the more common ones. There's, like, GitHub flavored markdown is another flavor of of markdown.
Michael:So these are just different flavors of the same thing.
Jake:So looks like it's all different. Yeah. Just different, markdown extensions that you can use to format the markdown that you're writing into specific, you know, different I guess I'm guessing it converts it to just HTML strings. Right? You could probably even create your own so that if you wanted to have markdown that had the specific, you know, when you see 4 hash marks, you should do this.
Jake:Or when you see triple backticks followed by a pound sign, you should do this. Right? You might be able to make some of your own extensions there.
Michael:Well, I see it looks like men things. Like Sure. You know, GitHub Flavored Markdown has the ability to have, like, quotes, block quotes. But you can also pass, like, info in in braces and it'll render that as, like, an info box or you can have an alert or, you know, all of these different kinds. So these extensions sit on top of whatever whatever format you're using, whether it's Common Mark or or standard markdown or whatever, and then do specific things to that markdown when it is rendered into HTML.
Jake:Very nice. So that's pretty cool. So you now have the ability to use those extensions as a third parameter, both in the, string and the stringable class as well. Okay. Macroable token guard.
Jake:Iman or l man? I can't tell. I think it's iman. Iman added the macroable trait in the token guard class to support custom macros on this card. If you've not heard of these this able trait, it basically allows you to be able to take a class that is, you know, part of the framework, but then you can customize it with your own methods by macroing on your own methods there to that inside of a service provider of some sort.
Jake:So, that's now available on the token guard and on many other classes that ship with the Laravel framework. Adam Campbell contributed the number pairs method that provides the ability to split a number into pairs of minimum, maximum, values. It's sort of like sliding, the sliding method except the method will determine the values for you. So you could say number pairs 2510. And what this is going to do is it's going to to be honest with you, this is a bit of a weird one.
Jake:It gives you a collection of numbers, a pair of numbers where it says in this case, it's, like, 110, 11, 20, 21, 25.
Michael:Yeah. I guess
Jake:it gives you from 1 to 25 separated by, amounts of 10. Right? So it starts at 1, jumps to 10, 11 jumps to 20, 21 jumps to 25, and then it stops. Right? So it says jumping by increments of 10, go off to 25.
Michael:Yeah. If you wanted to do, like, pagination, and if you had, like, a 100 pages, probably don't wanna show 1 through a 100. Laravel would would do, like, 12345 you know, 95, 96, 97. What you might want to do is to then have these paired numbers where you'd say, okay, up to a 100 or up to 25 pages, but show me 1 to 10, 11 to 20, and then 21 to 25. So you've only got 3 things in there.
Michael:So it helps you, like, chunk it up effectively.
Jake:Yeah. I I think it helps too to to discuss, like, the the order of the argument. So if you have number pairs, the first number is how high you wanna go up to. So 25 in this case. The second number is what amount you want to increment by, so 10.
Jake:And then the 3rd argument is what number you want to start at. So you could say 0. So if you did 25 comma 10 comma 0, it would say 10, 10, 20, 20, 25. Right? So, anyway, that's it.
Jake:You can you can definitely go take a look at the documentation for that. Nice little helper method there. Okay. Two more things here. Mark sensitive parameters with PHP's sensitive parameter attribute in 11.14.
Jake:Philip Leslie contributed sorry, Leslie contributed updates to Laravel to attempt to mark sensitive parameters with PHP 8 2's sensitive parameter attribute. So this is attributes. Right? We know what PHP attributes are and this is a really nice reminder to leverage this attribute in your application code if you're running greater than PHP 82. So what it allows you to do is use that pound sign sensitive parameter in order to protect that parameter from being exposed, I think, through things like logging or through, like, error tracking services that you might have.
Jake:You know, it's possible that if you don't set up your air tracking service to ignore certain strings, then it will just dump that payload into your air tracking for anybody to see, which is not great. So that sensitive parameter attribute should hopefully help protect some of that. You can read more about that in pull request 51940. I think a lot of
Michael:sorry. I think a lot of that PR is also to, like, take things that are in the Laravel framework codebase and mark them as sensitive so that they don't get leaked out in you know, if you forget to turn debugging off for whatever reason or there's a stack trace that appears somewhere, like, this will mark those things as sensitive in those outputs rather than, you know, dumping your, tokens or arrays of credentials or whatever else to to the browser for whatever reason.
Jake:Yep. I've definitely had to use this something like this before. I you know, before we're using 8 2, we had to create our own sort of version of this by wrapping something up in a DTO and then making sure it wasn't exposed, but, this is a really great way to do it if you're running, greater than PHP dot 2. Okay. On the last thing here, we've got improvements to the artisan serve command.
Jake:Seth Fat contributed improvements to the artisan serve command here there. You get a printout of better request time for requests than that take less than one second. 0 seconds isn't helpful. Right? So it's going to give you a millisecond count.
Jake:Also, it shows the request route instead of just a bunch of periods. Right? So instead of just the requests coming in, it shows you also the route that it's hitting and then the amount of time, that it's taking as well. So really nice, improvements there. You can find the rest of the release notes on GitHub, of course, between 112 and 1114.
Jake:That was a big one. Jam packed. Alright. Onto you, my friend.
Michael:Jam packed. Generics have been added to the Eloquent builder in Laravel 11.15. Probably their headline of this one, Caleb White contributed integrating relation generics into the framework. For those of you don't know, generics provide better order completion and IntelliSense in your IDE without having to rely on Larristan to add generics to the classes through the use of stubs. Having generics in the framework also makes it easier for third party packages to define the inner types on their custom relations.
Michael:Caleb has been contributing to Lara stand and is now integrating this into the framework, which will improve static analysis in Laravel. We can see pull request 51851 for more details. If, I know that, like, PHPStorm is pretty good at this, particularly if you've got the Laravel IDEA plugin, if you're using something else like Versus Code or Vim or or whatever else, you might be using Barry van der Wevel's IDE helper package which generates, like, these giant files that that does all of this stuff for you. So by using generics in the context of the framework itself, it will be able to infer, specifically what is being put in there. So it handles, using, what are they called, templates and things like that in order to make this accessible to you in your application code.
Michael:So thank you to Caleb for that. Christophe Ronppel contributed an update to the make mail command that will prompt the user for the type of the view they'd like to create, so whether that's a markdown view or a regular view. Mohammed Sari added the tappable trait to the router class, allowing you to do, something like, instead of doing, like, a router post and then chaining name, you can now do router tap and then pass, class names in there rather than having to use the string variance. So it might be a bit cleaner for your, router usage whenever you're doing route registration and things like that in a more, I guess, advanced way than just in the routes file. Havers Divandari contributed updates to database migrations around SQLite and other quality of life improvements.
Michael:And in summary of the pull request, it introduces extended SQLite support to version 3.26 plus, support for adding and dropping foreign keys on SQLite, adding and dropping the primary key on SQLite, and preserving the order of commands, and a blueprint state for SQLite. So these are all, predominantly behind the scenes, under the covers, whatever you want to call it, changes, but they improve. Especially now with all of the extra love that SQLite has been getting, it improves the development and in particular the migration story for those of you using SQLite, not just in your tests, but, you know, even in production. And lastly in this release, Jayan Ratner contributed support for setting up MIME types on attachments inside a resendMailable class. This pr adds the withMIME method, which is, basically saying if you have an attachment, you can say attachment colon colon from path, wherever that is on your file system, as whatever the file name is.
Michael:And then with MIME. So you can explicitly say this is an application slash pdf type, just to make things more, I guess, consistent between different email clients. But we'll have links to that and all of the changes in that Laravel 11 dot 15 in the show notes.
Jake:Very nice. That's awesome. Okay. We've got some more awesome stuff on the news side of things. Caleb Porzio, who you should know about, the creator of LiveWire as well as Alpine JS, has just released a resize plug in for Alpine that allows you to react easily when an element changes.
Jake:So this plugin is just a wrapper around the resize observer API. So this is something that was I'm not actually sure what the support is. I'm guessing it's probably pretty decent if there's an alpine wrapper around it, but this is sort of the long discussed element query idea. Right? So we've had, like, you know, what is it, like, media media query or something like that, like, we've used in CSS for responsive design for forever.
Jake:But one of, like, holy grail things was, like, what if I'm not interested in observing the size of the document, like, the actual window, but what if I want to know about the changes in size to a specific element on the page and then be able to react to those specific types of changes? That's what the resize observer API does. It's this built in performant mechanism, to monitor element changes for size, and then it delivers those via some notification to an observer. Right? So instead of having to set that up yourself, now you can just use this x resize, and then you can bind the width that comes through and the height that comes through to data that you've already set up on your alpine component.
Jake:So, in the example here, which is gonna be, you know, much easier for you to understand if you're looking at this, but in your x data, you're just going to set an initial width and height. Right? So I'm just setting my width to 0, height to 0, whatever. When the resize event is fired, so x resize, what you're gonna then do is that's going to give you the width and the height variable, and you can do whatever you want with those. In this instance, in this example, all they're doing is they're just binding that that variable value to that x data variable that you'd set up and then displaying it.
Jake:But you could do all sorts of stuff. Right? You could do lots of different things when that resize event fires, you can do whatever you want to do with that width and height. So, you know, the sky is the limit. I'm sure there is some interesting, maybe some demos on the, on the Alpine site for how you could use this, and there's also a way to know the width and height of the entire document if you pass along the document modifier with this.
Jake:So do what you want with that, but pretty cool. I actually was not even aware of this resize of for observer API. I feel like there's been some really interesting things coming out just on the browser side of things. There's just, like, this new positioning thing, like, anchor positioning now, I just saw recently. It's sort of like relative positioning, but it's like, you know, what you would have wanted.
Jake:You know, tool tips have been always such a pain to position, and this anchor positioning basically solves that problem. So the browser manufacturers are doing a great job, putting all this new stuff out there and really helping to solve some of these problems that were almost just impossible before without hacking something together that just was terribly perform you know, not performing at all.
Michael:Yeah.
Jake:So glad this is out here now and also glad to have it available to us in a really simple way in Alpine. So thanks, Caleb, for putting that one together.
Michael:I think I saw Wiz Bodd's Twitter the other day, something about, like, there's now Hype Auto Works, which is, you know, surprising that this is not a thing that we've had until now. But here it is, 2024, and we've got Auto Hype. So
Jake:Here it is. I'll see
Michael:if I can Yep. Link that one up in the show notes for everyone as well. You you put in here, Tinkerworld. Did you wanna talk about Tinkerworld? Because I know that you use it all the time.
Jake:I use Tinkerworld all the freaking time. It's great. And so I saw that it was released. So Tinkerbell 4, is out now. Some of the things that are new in this one is there's this detail dive.
Jake:So this is the new main output mode, and so, it has structured expandable cards instead of this, like, CLI REPL output that's similar to, like, a terminal output. So it gives you the option to sort of expand these cards to see, like, SQL queries. It's it's a really good way to, like, dig into collections and arrays and debug those pieces and see them in a really nice little componentized way. There's also, table mode. So this was previously like tinker instead of, like, a different tinker mode.
Jake:This is now also part of that detail dive output, so it kind of displays it for you right in line there, and it allows you to, like, display, filter, export data, from the values that are coming back. You also have mailable previews right in line. You have an object graph that you can use, which shows you the different relationships of objects, within the object graph view of Tinkerbell 4, all the all the related objects, and and you could dive deeper into those different things. It looks almost like a, what is that called, Michael? Like object relational map?
Michael:Oh, yeah. Entity the entity diagrams?
Jake:Yes. Yes. Exactly.
Michael:Entity relation diagram?
Jake:Yeah. Yeah. Yep. So it looks really it's it's very cool. Yeah.
Jake:It's got AI code generation in in it now as well as log tailing, custom themes, blah blah blah. So lots of stuff to take a look at. They've got a great announcement page that shows all the different things, that you can go look at yourself, but you should definitely check it out. I love using Tinkerbell. I use it all the time.
Jake:Just bought it for another dev on my team, a new junior dev, and, really, really good stuff. So I would highly suggest checking that one out. Congrats to the team at Beyond Code for another great product launch.
Michael:Yeah. Speaking of Beyond Code and product launches, Laravel or Herd version 1.9.1 shipped with support for PHP 8.4 alpha 1. The first release of PHP sorry. The first release of PHP 8.4 is now available and ready for testing. It is scheduled to be officially released on the 21st November this year, but but before the release, it will feature 6 months of pre release phases going from alphas to betas to release candidates and then eventually the final release.
Michael:So if you have the latest version of Laravel Herd, you can go and install a 0.4 alpha 1 and start testing. And of course, when alpha 2 comes out in any of the future beta or release candidate releases, you'll be able to update that with a click of a button inside of Laravel Herd. The PHP team is asking everyone to please carefully test the version and report any issues using the PHP bug tracking system. Don't use it in production though it is not ready for that. And when you are testing it, you probably want some kind of observability tool and that is provided by our friends at Honey Badger.
Michael:They've been busy at work since the last time they sponsored the show working on Honey Badger Insights which is their take on logging and performance monitoring, helping application developers gain deeper visibility into what's happening with their applications. And it goes beyond application monitoring and responding to exceptions and downtime, it will let you drill down into the details and step back to see any patterns in the data.
Jake:Yeah. Like, for example, one of the quotes was, it's Splunk like querying without having to sell my kidneys. That was a direct quote from someone who just saw the Honey Badger Insights, the observability tool. And, they said it's it's like a fresh approach to logging and performance monitoring and observability without having to rewrite your entire code base. Right?
Jake:Like Splunk, Datadog, CloudWatch logs, but with just the good parts and very reasonable price tag. In fact, the best part is that this is all available on Honey Badger's free tier as part of their comprehensive monitoring suite, which includes like air tracking, uptime monitoring, status pages, and all that good stuff. You can gain deeper visibility, see see, patterns in your data, and it's really simple to query your logs and events, to create charts and dashboards. So you can get started for free, pay as you grow, or choose a 30 day free trial to unlock the full power of Honeybadger right away by visiting honeybadger.io /plans. Thanks so much, Honeybadger, for sponsoring the show.
Michael:Yeah. I've been busy, busy badgers.
Jake:Indeed. Indeed. Okay. Did we Well, we, Did we talk about this? Did we
Michael:talk about this last show? Did I not say that, like, someone's gonna build a plug in to do this? Or is that on on, on North Mid South? I'm sure I said someone is gonna make a role and permission management thing at some stage.
Jake:I think we talked about this before. Yeah. We talked about it a couple weeks ago, I think. I actually do you remember Joseph Silber? I'd said something about this not too long ago, and we had a discussion about it on Twitter a little bit.
Jake:And so I was anyway, yeah, we're we were talking about it a little bit not too long ago, and you were talking about this. Like, hey. Somebody's gonna come up with a really good way to do this, and they have. You wanna talk about it a little bit,
Michael:Here we are. Filament Hexa Lite is an effortless role and permission plugin for Filament. The plugin provides an admin only UI to manage different user roles and permissions that you can use to control access in your Filament applications. The plugin creates a separate admin table to manage roles including the ability to edit roles and permissions as an admin, define permissions for resources and pages, define permissions for actions, and validating access to permissions. The Hexlight plug in provides a variety of ways to check access permissions on resources, pages, widgets, and so on.
Michael:You can use the Hexa global helper. You can use the auth user can functionality that we have available already and you can use gate allows. And you basically send all of these things as hexa. And then whatever the permission is that you're checking. That is key to remember generally with roles and permissions.
Michael:You want to assign roles and you want to check permissions. You can learn more about the package and get full installation instructions and view the source code on GitHub. We will have links to the readme and all of that good stuff in the show notes.
Jake:Very cool. Our next package we have is something that is sort of a plug in or an add on to another package called Laravel REST API. So Laravel REST API is a really quick and easy way to manage your API in Laravel. And so I'm looking at some of the documentation, and it seems like, what it does is you can sort of define in I think it's like I'm not sure if it's in, like, JSON or if you actually just if it's just a convention for, like, using their own artisan commands to scaffold things up. I can't tell exactly, to be honest.
Jake:But what this package is that's this add on is it's by specifying a search text value, you're able to now make a full text search from your front end side using a Laravel Scout integration. So you have some small limitations on the arguments you can provide, but it doesn't restrict other features, which allow you to perform, you know, these these large full text search queries.
Michael:So the the package itself is a, as as quoted, an elegant way to expose your app through an API and takes full advantage of Laravel ecosystem packages such as or functionality such as policies, controllers, and Eloquent. Mhmm. You'll find there multiple endpoints are exposed when using the package, which allows you to mutate, search, show, and delete records in your application. So this is, like, this is additional
Jake:On top of your existing application, if you just wanted to create an API, it
Michael:looks like you guys
Jake:Yep. Right.
Michael:This package. Yeah.
Jake:Artisan rest controller, and now you have a users controller, which is now an API endpoint for you, which provides, you know, all the all the routes, all the controllers, all of the, those what are those things called? They're just re the JSON resources, right
Michael:Mhmm.
Jake:For those particular models, and builds all that up for you, I guess.
Michael:Yeah. Does it does
Jake:it seem right? Yeah.
Michael:So this allows you then to specify search text value in your search, and it'll it'll give you full text search capabilities using Laravel Scout.
Jake:Oh oh, I see. I see. So it's best basically, it gives you a new endpoint for that API that you're building out. So, like, if you previously would have just had API slash posts, which would have had your you know, all of your regular rest verbs, you now have a slash search, which you can just pass in a value to search, and then it will give you back the results, I guess. I see.
Jake:Okay. Okay. That makes sense. That makes sense. So, if you're using Laravel REST API to build out an API for your existing, application, you now can in addition to building out a index, a, you know, get specific record and update specific record, you now also have this search endpoint, which uses Laravel Scout behind the scenes to expose this search.
Jake:Okay. Yeah. So it seems like a search.
Michael:Yep. Yeah.
Jake:Full text search. That seems good.
Michael:Yep. Yeah. So it gives you the ability, like so that you have this new endpoint, which is API slash post slash search, and you can pass in
Jake:a
Michael:search text value. And then you've got the ability to scope and filter that and sort it and things like that. But it will return to you, all of the things based on your search query using Laravel Scout, under the hood in order to then determine you know, to do the full text
Jake:search.
Michael:So wherever that is, whether it's Algolia or Mealey search, or if you're just using MySQL full text search, it's all there. But it's it's got all this stuff around, you know, using scopes and and filters,
Jake:realizing Inside of your
Michael:operators. Yep. Specific type of filtering. Right.
Jake:Yeah. Right.
Michael:Yep.
Jake:Yep. Which builds all that offer, which is to be fair, that can be a pretty complicated thing to build out yourself. Right? And so it's it's already built out for you. So all you have to you pass that value in and then all your filters sorts, your selects, your includes, your aggregates, your instructions, etcetera.
Jake:Mhmm. Yeah. That's that's pretty comprehensive. And, if you happen to be using that package already, it seems like it'd be a no brainer to add that search endpoint onto those, as well. Very nice.
Michael:Yep. Very cool. We we spoke a few episodes ago about the release of the first party default exception page. This was in the Laravel 11 point 9 and the existing error solutions feature that was part of the old page that was provided by the the Spasci package was removed. The Laravel error solutions package created by Spasci brings back the solutions for the most common errors that users face.
Michael:So if you, for example, spin up a new application and you have no application encryption key specified, with the default error page it will say you don't have an application key specified, and then you will, you know, go off to the terminal when you when you run that manually. If you install this Laravel error solutions package, you'll get back the suggested solution which is, you know, it'll tell you that your app key is missing, that you should generate the key, and then it'll give you a button to generate that right from the exception page, and then things will keep working. So the package itself brings back the following features to the error page that were previously provided. It will display error solutions to common errors like function name, typos, etc. It will automate running some solutions that can be fixed automatically.
Michael:It provides support for AI generated solutions, and it will create a custom solution class to add to your own solutions. You can get started with this package by installing it as a dependency over application and then publishing the, error solutions configuration so that you can make whatever modifications you need there. But we'll have links to all of that for you in the show notes.
Jake:Very good. Hey. I'm looking at, this next one, which we we have listed as a package and was listed as such on, the Laravel News blog as well, but it's more of a tutorial, I would say, than anything. And so I'm gonna I'm gonna keep it in this news section here, talk about it just real quickly, but I'm not gonna go into great detail. I'm more just gonna put it out there so that you know about it.
Jake:We have talked about this in the past. We have you know, we're very it's it's a great thing to have options. Right? And so as a Laravel developer, if you're looking to create an admin tool, you have multiple options. Right?
Jake:We have, first party support with Laravel Nova, which I use. I also we also have, the ability to use Filament, which is you don't have to use the admin portion, but they have that as well. I've used that before as well. And you also have, backpack for Laravel, which I think was around before either of those, it was sort of one of the originals.
Michael:Been around
Jake:for a while. Yeah. It's been around for a long time. So this is a tutorial around the different packages, this collection of packages that allow you to create admin panels for any web app. So it goes through here's the core packages that are included.
Jake:Here are ready made CRUD packages, like managing permissions and settings and, you know, languages and translations and files and all that stuff. So some of them are paid. Most of them are free. And so the backpack team maintains all of these add ons, and, you know, there's compatibility between all the different ones, regular updates, so you're not gonna have, like, some surprise dead package. They they maintain all of these ones, these these core packages here.
Jake:So, you know, if that's something you're looking at, if you've been unhappy with either of those options, Nova, Filament, which we talk about quite regularly here, this might be a good one to check out, and it has, you know, some great first party tools. Like I said, that language, manager, translation manager, if you find having to do that inside of your code base using, like, those translation files is a pain in the neck. Maybe this is something that works better for you. So couple different ones that are in there that you might want to check out, so there you go. Backpack.
Michael:Nice. Alright. And to wrap up the remainder of the tutorial section, we have 3 for you. So first up, my friend of the show, Jason Beggs, is how to migrate MySQL from DB engine to Laravel Herd. So ever since Laravel Herd Pro was launched with the ability to manage database and cache services like MySQL, MySQL, Postgres, and Redis, He had been waiting to switch from DB engine to her's MySQL and Redis.
Michael:Now you might think, how do we go about it? A lot simpler than you think. You stop DB engine's MySQL service. You create the service in Herd, and then copy data from one to the other, and then restart MySQL in Herd, and everything just works. Little bit of nuance to that and what you specifically have to do, but the link to the tutorial will be in the show notes
Jake:for you. I wish I would have seen this beforehand because I actually exported all of them and re imported them, and it was a massive pain in the neck. And so this is definitely the way to do it. He does mention if there's any really sensitive stuff that you cannot lose, make a backup first. But otherwise, this should work perfectly.
Michael:Yep. Perfect. Next up, we've mentioned Ash Allen a few times on the show. He always writes some really in-depth articles. He has a couple books out there.
Michael:He's got loads and loads of content in the community. This article, this tutorial, is learning to master query scopes in Laravel. Goes through what they are, what local query scopes are, what global query scopes are, how you can create them, how to apply them, and more. Huge in-depth article. Please go check it out and make sure you shout out Ash Allen for all the great work that he does in our community.
Michael:And lastly, again friend of the show, Jason Beggs, how to redirect uppercase URLs to lowercase with RFL middleware. Talks about handling all of that kind of redirection stuff where someone might type, you know, they might be looking at a location Atlanta and they want to change it to Chicago, but they've typed Chicago as a proper noun. And so this is handling the redirection with appropriate error, with appropriate status codes and things like that for you if you ever had to go about that, kind of in the same vein as self healing URLs and things like that. So we'll have links to that in the show notes. But that is it.
Michael:That is all we have this week.
Jake:Alright, everybody. Thanks so much for hanging up out with us. This is episode 219. You can find show notes for it at podcast.laraveldashnews.com/219. If you like the show, we'd really appreciate it if you'd rate it up in your podcast host choice.
Jake:Five stars would be incredible. And if you have any questions, hit us up on x@michaeldorinda@jacoblemondor@ Royal LaNeese. Till next time, my friends. We'll see you later.