YouTubestream· Jun 7, 2025· 2:22:54· 1,700 views on YouTube
React at a moment you like. The best moments light up here.
[Music]
Hey, hey, hey. [Music] Heat. Hey, heat. Hey, heat.
[Music]
Hey. Hey. Hey. Hey, hey, hey.
[Music] Hey, hey, hey. [Music]
Hey, cool. [Music] Heat. Heat.
[Music]
Good morning everyone. How's everyone doing? Let's see. Is that a little better? There we go. Awesome. Hopefully you are doing great. Um, I wanted to go live a little bit more. Uh, is it only me or is the audio cracking? Hopefully it's not. Let me
know if anyone else says the audio is cracking or not. Um, it looks at least like the levels look good where I am at. So hopefully um hopefully it's not. Florian, I'm about to get on the stationary bike in the gym. Give me something to distract me. Gosh. Well, have you uh here's here's this for distraction one. I'm just going to be I don't know
preparing. So, like I have not met Chris. Um uh the audio is broken. Oh no. Let's see.
works on Twitch but broken on YouTube. Well, that sucks.
Let me go ahead and see if I can fix this. It's weird that it's uh it's broken on on um broken on YouTube but not Twitch. So I basically am using uh this free version or not free like it's it's a hostable version of reream called rereamer. It's basically like a reream alternative kind of thing. Um so I'm
pushing to twitch, Twitter, and YouTube with the same audio file. Uh, so it's interesting that YouTube is breaking, but everyone on on on Twitch, everyone's audio sounds fine. Only on YouTube it is broken. Very interesting. Seems better here than YouTube. Is it still not a great learner
0418? Glad to have you here. Thanks for thanks for join popping in. Um, and thanks for the follow. Uh, and exit is fine. Only on YouTube is broke. That's so weird. Um, let me see if I can Let me like just maybe reset it and see if that fixes it.
This is why I went live a little bit earlier before having uh Chris pop on the pop on the stage cuz I wanted to make sure um there weren't any issues.
All right, I reset it on YouTube. Is it still broken, everyone?
switch to Twitter. Fine. Over here, says Floren. Well, glad to have you on uh uh glad to have you on Twitter now, Florian. I might have to just end YouTube, unfortunately, if it's still broken. I'm waiting for some uh some more comments.
Oh, it works. It works. Sweet. Okay. All I did was just turn it off and turn it back on again. Um that's the way to do it, I guess. Uh, so I'm basically using I'll have to I'll have to make like a video about this sometime. Basically using like on I'm I'm hosting on Docker. I'm actually using Coolifi to host it. Um, it's just a simple basically like a one-click
command to install this thing called rereamer, which um I can set like my own custom domain and then I can basically just give it a stream value and then it will push it to any other source for me. So, Twitter, YouTube, and uh Twitch. Um yeah, I'm glad it working. I I literally just turned it off and turned it back on. That is that's the the win of the tech world. But yeah, thanks so
much everyone for joining. Um I I I wanted to go live mostly to clear out those issues first before Chris got on. Um but so he he's gonna jump in. Um and of course, we'll probably have a bunch of issues. This is the first time, actually, this isn't the first time. This is the first time I set up like a really better looking like uh before I think I had a guest on the stream. I just used uh like Google Meet and we
just like screen captured like Google Meet, but now I actually have like a cool little dual text setup. Um and uh yeah, I'm super super excited. one, I wanted to get go live a little bit earlier to to hopefully talk through with you all of what I should or how I should approach teaching Chris. So, Chris reached out to me um and I'll tell this story again like when he's on in a little bit, but Chris reached out to me um and was basically like, "Hey, I don't
I want to learn Laravel. I don't know where to start." And so, I said, "Well, why don't we do it live on stream?" So, I've never met him before. Um except for, you know, just watching his YouTube videos. as I watch his I I learned from his Astro course. Um he's coding on public on YouTube. Um and uh Jason on Twitch says, "What's the
longest you've used one setup?" Um I I plead the fifth on that. There there's a funny story with my with my setup process because uh well, not I guess it's not funny. I so I I try to record all my videos. I rarely ever do re-shoots. Um but there was one video I was recording for the the Laravel official channel and all of a sudden
um like we I needed to reshoot but I had changed my whole background and so I literally couldn't so I had to redo the whole video. Um uh but yeah, I just restarted it and it works fine now on YouTube. um on Twitch. Thanks so much, Lionus Dev and Learner and Jack Pretty and Coding with Lewis. I know you're on YouTube, but you also uh sub followed on Twitch. So, thanks so much. I appreciate
it. Um I try to keep the same setup though. But, uh yeah, we'll see how we'll see how it works with uh getting getting Chris on. I I set up for those who uh are in the streaming world, there's this tool called um ninja. OBS, is it ninja? VDO.Ninja
vdo.ninja. And it's basically just like this little like low latency um thing that gives you like a browser source, but people can connect to it. So you can like see their camera and then they can connect it. you can see their their uh their screen. Um and yeah, we'll see how we'll see how it goes. Uh um but yeah, the the I want to so he reached out to me and he was like, I
want to learn Laravel. I said, hey, why don't we do it live? And then um I was basically going to figure out what to what to talk them about. And a lot of it's probably just going to be like, okay, he has literally never touched PHP. He has literally never touched Laravel. So, it's going to be very basics install process, but then also just like, okay, what's like the first step? He is an Astro dev and so he's familiar with React. Um, so we
might do we might do Inertia, we might do React, we might do Livewire to make it easier. Um, uh, send me links. I want to try a new setup. is uh vdo.ninja ninja. Really super cool that and and like whoever has create created this I don't I I apologize like to the author. I don't know who who created it, but there's like a whole slew of tools for
like streams. I I haven't gotten this one set up, but you can also like have chats from all of all of like the the live stream aggregate system. You can like have them show up on your screen and you can customize how they show up and everything. Um, it's like called social stream, but there there's like 20 different tools that that this person makes. Um, Harris works fine here. Well,
I'm glad that I'm glad it glad it works now on on YouTube. Um, YouTube is where the most people are. So, like I would that would have sucked it if I couldn't get the audio right. So, I'm just hoping it stays like that. Um, let me know if it doesn't and I'll do like the on and off again. Uh, yeah. Thanks so much everyone for for hanging out. uh learner. I'm trying to build a social media app for devs as a way to learn full stack dev. Awesome.
Sweet. It'll be cool to uh see see what it is. Uh thanks for joining us. Um Streamyard finally added on screen chat. Yes, it finally added on screen chat. I still so we use for uh um the riff and refine podcast which will be going live in just like three hours from
now. We still um we use um we use Streamyard for that cuz just because it makes it easier to stream to more like I can stream to all my places fine but if I wanted a guest to also stream to their places like just doing all that through OBS is such a pain. It's doable but such a pain. How's the music level, everyone? Too quiet, too
loud. Um, I always like to like this is royalty-free music using stream beats. So, I always I always like to like have a little bit in the background, but if it's too distracting, let me know and I'll turn it off. Um, especially once once Chris gets on. Speaking of, he probably is jumping in. Again, we're doing all this live. I have not talked
to him yet. I sent him like some info. um to like join the stream. Um yeah, let me let me pull it up and see what we can do. Yeah, Jason, you don't hate Streamyard, but it definitely needs work. Yeah, it's one of those things
where like another thing I can't I can't um tell it to give more bit rate, but like for some reason my camera like I I like just looking at YouTube like it feels like um uh very quiet bass was high. Okay, so I'll turn up the music just a little bit. Yeah, someone says I don't even know I had music going. Um, but yeah,
for some reason on StreamYard, my camera looks very blurry. Like it's it's not as HD as it could be. And I like and maybe it's just because I'm like pushing more bit rate to YouTube um when I'm just streaming through OBS. Um, and so that's what I'm used to. But yeah, for some reason Streamyard messes up my camera and I don't know why. Um, I mean it's it's probably it's probably fine for
majority of cases. It just bothers me because I know um uh I don't know how to pronounce your name, but Wow. Yao J O A O I I'll call you. Wow. Um glad to have you here. Uh let me pop over to the um pop over to where Chris is and let's
see if we can get him on the stream. I got to pull up this might be the bit rate. Yeah, it's probably the bit rate for StreamYard, but at the same time, I don't think there's a way to change it. And that's the frustrating part. Like, I can't tell it, hey, give like allow more. Um, I I already set it to allow like to HD, but
I think like that's as high as it allows. Pull open this.
Hello, Chris. Can you hear me? [Music]
Can you hear me, Chris? Testing one, two,
[Music] Heat. Hey, Heat.
All right. So, I'm trying to get Chris on. I I can see him, but he can't hear me just yet. So, I'm trying to get him on right [Music] now. Um, let's go ahead and pull this up.
All right, let's see. [Music] Let's pull open this. All right. So, we can see Chris
there. All right. I can see Chris there, but I don't think he can hear me yet. So, let me grab this link and see if I can That's really what it comes down to him not being able to hear me. Um, let's see.
[Music]
Can you hear me at all now, [Music] Chris? That is weird. I can hear Chris. I can see him, but I don't think he can hear me. So, I might have to jump on a Discord link or something with him.
[Music] Let's see. Let's see.
[Music] All right. All right. So, I thought I had tested this out. I tested this out um by myself, but maybe like there was some weird thing where I I thought I was hearing myself, but I really wasn't. Um, so I know that uh this video ninja
like I can see him and hear him but I cannot uh he cannot see or hear me unfortunately which is the the interesting part.
All right, calling him on Discord.
All right. Can you hear me now, Chris? Sweet. Uh, yeah. Let me let me turn on my camera here. And you probably can turn off or turn um I think Yeah, I think if you keep the the camera on the other one and then I'll just share my camera here. Kill your camera on Discord just for latency sake, I guess. And I'll
share my camera here just so I know it's a lot. Let's see. Let's do this. Perfect. Can you see me now? Sweet. And and then let's see if Chad can hear you cuz I'm bringing up your your screen over here. Oh, well that's the screencast one. Let's do side by side so I can just talk to you first.
It's nice to Yeah. Nice to meet you as well. Okay. Um Bam. Let's see. Okay. Can everyone see and hear Chris? here. Chris. Chris, say something. Chris, say something. Hey everyone. Hopefully you can hear me and see me. Maybe we got it worked out. Cannot hear Chris, by the way. Chris, by
the way. Yeah, I can or can't. Let's see. Let's see. I can uh I do have both unmuted. Do I need to mute or I have Yeah, but yeah, both unmuted. Should I mute my audio on Discord? Um I see um I see the the [Music]
I see the um the um the guest webcam webcam audio going live going live success. Okay, we got we got Well, good well good to meet you. Thanks for having me on. I'm uh excited to be laravized or I'm not sure if there's a a verb form of that but excited to learn.
Got some echo. Got some echo on me. Okay. So, there's some echo on my side, but everyone else can hear can hear him. Let me see. Let me see.
I'm just going to drink coffee if that's cool. If it's echo for me, I can put on my headphones if that's better. Um, I think it's because So, I'm gonna Um, okay. Go ahead and say something now, Chris. Let me make sure we can still hear you.
Okay. So, can people hear Chris? Okay. Like when he talks there or No. [Music]
Oh, it says, "I have a feeling Chris has the wrong mic enabled. Yeah, I think that should be better. Let's see.
Okay, plot twist. This is just a stream about figuring out streams. Stream about figuring out streams. We're not even We're not even going to get to the Laraveville piece. Um, this is warm up, man. Someone says, "Thanks. It is okay now." Oh, but someone says, "We cannot hear him now." Uh, there's a little bit of a uh of a of a latency delay because of a because of how I have it set up,
but let's see. No worries. Perfect. Okay. Jason from Twitch says it's perfect. So, we'll go we'll go with it. Awesome. I'm getting all the levels. Like I've seen all the levels and they look good, but like I'm also listening to you through Discord and not like what everyone else is listening to. Sweet.
So, we got we got another good no echoes, good audio. Perfect. Awesome. I love it. That's what we want to hear. There we go. 15 minutes. We did it. Uh Chris, nice to nice to meet you. Yeah. Uh thanks so much for re reaching out first of all and then thanks so much for being willing to just do it live and uh and uh deal with all all of this. This is the fir you're the first guest that I've had like especially like with this with this setup. So it's fun to be able to like figure it out and hopefully now I get a better understanding of how
things work for the future kind of thing. So you're you're the you're the guinea pig. No worries. No. Yeah, we're uh so at works I work for Resend. That's an email API. um for developers and we're going to Laracon and so that was my motivation. Yeah. So we just just sponsored that so I'm going next month for that and uh I was like man I I should probably at least have a clue what Laravel so I was like who I know who understands JavaScript but also understands Laravel. So I mean you're
top of that list for me. So I I reached out and yeah I'm glad to do it live. I I have literally not looked at anything intentionally just because I figured if we're going to do it live we're going to do it live. So that's that's how we like to do it. There we go. There we go. I love it. I love it. Yeah. And then uh so you've never touched PHP, like not even like WordPress days. I mean just maybe at some point like pre-dev days where I wasn't really dev. I And I haven't been
a dev that long. Um it's only been about 5 years actually. So um the pandemic. Yeah. You're about my hands. Yeah. Okay. Yep. Yep. And I just jumped straight in and uh learned HTML, CSS, and JavaScript. and then fell in love with Astro pretty quickly and done a lot of stuff in React and uh Next.js and yeah other yeah tried to move more full stack but yeah never really touched PHP. Nice.
And so is that what you use a lot at at recent right now is mostly React and probably not too much Astro at recent right now. No, I don't think my influence is that strong. I was going to say pro probably not like too many marketing sites. Uh yeah, I'd love I I've personally love Astro. I've taken your Astro course um at least like 80% of it, but uh I I jump in there
every now and for everything. Um but yeah, I think uh one of the things my my hot take a lot of people um you know always say like oh what's like the JavaScript equivalent of Laravel? And my hot take is that Astro is the closest thing mostly because I think to be a JavaScript version of Laravel, you have to have some opinions while also having some flexibility. And so I think there's frameworks that lead
way too much on the flexibility. And so you're never going to have like, oh, this is the way you connect to a database and do this. Um, and Astro I think still is more flexible in that sense. But like I feel like okay, you have a flexibility of using like front end stuff, you know, Vue, React, Solid, you know, whatever, or just Astro's HTML language or whatever. But then you also
have, oh, hey, here's like Astro DB and this is like how you this is our this is our opinion on how you should use back and you can use anything else, but this is our opinion on how you should do it. Yeah. Yeah. I think that's what like that's what a lot of I think that's what really it boils down to of like what JavaScript or what the laral for JavaScript should be. Um my opinion on like a lot of the PHP
stuff just from a distance has been like they um it seems like the PHP world tends to have more opinions on stuff and JavaScript developers say they want them but whenever there's a framework like red redwood.js JS or something like that that tries to be more opinionated, people kind of just push it away. It doesn't really gain the traction. I think it's because JavaScript developers like like the language just want to be able to do stuff like 16 ways and not be really told how to do stuff. So my
opinion about Laravel and PHP from a distance is like there's more uh there's more paths that are kind of defined predefined that like this is what you should do. you can maybe have more flexibility, but like there's kind of, you know, off built in and, you know, like that kind of stuff. Like there's more built-in paths and so that tracks with my general assumptions about PHP um and that world. Sweet. I I'm excited to
to dive in and just like just start doing it that way that way I can hear I'd love to hear your thoughts as we go of um you know first off like we're starting from absolute scratch everyone like he hasn't looked at documentation you haven't installed anything so hopefully we can go through that fast um but uh yeah let me I have I don't remember doing it so maybe I did like a couple years ago or something I don't
know but yeah recollections um first I'll have you like share your screen. And to do that, if you go to I'll I'll I'll put this in your DMs on Twitter, but if you go to [Music] um if you go to this uh video.ninja.
Yeah, it looks like there's a share screen option there. Yeah. And uh not in the one that you're already sharing the camera though. If you go back to video and and click into remote screen share so I can get a separate link from you. Ah got it. Um so after you screen share then there should be a um remote screen share into OBS. Yes, that sounds right. Correct. Okay. And when you do that or after you after you click into it and
and share, there should be a link that it gives and then if you can send me that link. Okay. Yeah, I can do that. I'm not sure which screen this is saying I'm sharing. So, I guess we'll see. We'll we'll we'll figure we'll find that out. Screen one, screen two, screen three. I no idea. No audio sources detected. I think that's okay. Yep, that's fine. Um, it is
sharing something. Oh, I think it's even the right screen. There we go. Uh, copy link to clipboard. Oh, it's happening. Sweet. Perfect. Okay, I'm going to copy it. I'm going to put it into my OBS. We'll go here. We'll go to guest screen share. Plop this
in. Oh, it copied the Twitter link. Let's see. So, I need that link right there. Perfect. Plop this into OBS. Okay. Fingers crossed. There we go. I can see your back black and white resend uh resend background. Yeah, it's
actually a raycast one, but it is the same vibes. So, yeah, resend Racecast. Um, sweet. So, we're seeing all this. Yep. We're seeing Laron. Cool. I like it. This is the motivation. There we go. There we go. Yeah. I'm I'm I'm excited. Uh, I actually my first video that I did for um my first video that I did for uh Laravel. I actually did a resend video.
Recent's Laravel adapter had just been released at that time. So, I I had pulled that up and and did one. Um, so yeah, I I I like I like resend. I I don't get to use it as as much because most of my projects I'm never going all the way into into email, but maybe we'll maybe we'll install it and like send a send an email or something. That'd be fun. Yeah, I won't argue with that. Um, sweet. Let's go to uh laravel.com and
let's like get started. So there the we the the whole purpose of like if you click on um just or there's this command right in in there. Sorry for the video that uh got my way. Yeah. Um it's probably because your your screen is a little bit big. Yeah. If you click on for you, but u if you click on like that composer global require Laravel install. Um we you probably don't have composer or PHP installed. If you go into your
terminal, we can maybe I did like a sample for something with recent once where I just installed to see if I could get a repo to work, but I don't think so. Yeah. If you do like composer-v. Okay, I'm seeing green. That's a good sign. That is That is a good I got something. Sweet. Um do Laravel-V. I'm curious if you have like the Laravel installer installed now. Doesn't look like it. Sweet. Awesome. So this this command that we have then is good because you have composer installed. Um
yeah, let's do that. Okay. So what is made anal what is composer analysis to analogous to? Composer is analysis to uh pretty much to npm like that's like the closest configuration for the longest time and I I was this is way before I even got into PHP for the longest time most people said like it was very hard to do anything within like PHP packages within the PHP world. But then composer
came along whenever that was people in the chat can probably let me know. Uh but when composer came along then it just made things easier. So basically this this is the mpm version. You install packages you keep packages up to date. Um and like it has like this that composer uh global installer that we said you have the ability to basically like it's kind of like mpm and mpx allin one where we now have the ability to actually run
stuff as well. Okay. Cool. Yep. Exactly. And and that's not as analogous because like there's it's not as I can't just run it one off, but I can install packages globally that I can run one off if that makes sense. Okay. Yeah. Yeah. Um so now we should have Laravel installer installed. So if you run Laravel-V just to like double check, we
might have to like restart source. Um or I can just restart all together. Yeah. Let's see because I know sometimes there'll no command not found. So we probably So we already ran the global installer. So we probably need it added to
our zsh. Okay. Um so let me pull up my uh my one just so I know where it is. It [Music]
is. I'm ready to go over here. Let me see. I can't see chat either, by the way, or anything. So, if somebody does have questions or things for me, I'm happy
to. You'd have to relay them to me. I'm assuming you know, you know that, but just in case somebody's yelling at me at any time. Yeah, I love it. I'll I'll uh let me go ahead and copy this. um for you and put it in our Twitter. No, no com uh no questions just yet. Um
let me see if put this in your So if we add that export path composer vendor bin that should give us what we need. Somehow I copied a bunch of stuff. Our whole thread. Let's try it again. Sweet. So yeah, I'm just going to do I guess this is just composer. Yep, that is just composer I believe.
Okay, so let's try this again. I'm going to source it and then am I trying Laravel again? Yeah, let's try Laravel again. Sweet. It worked. There we go. Awesome. Let's do it. Crisis averted. Bam. So now we can run as simple as Laravel new. And then we can call this uh let's just call this uh Astro to Laraveville. Let's do that. Let's do that. Wow, man. Conversion already.
Uh no, I actually think I think um here's where I I'd be curious to hear your thoughts. So like this is where I'm always interested, especially as I'm teaching new people. Um especially for people who are interested in in React, it's nice to know, oh here here's some like simplicities, but at the same time uh there's a lot of stuff that's like oh that's just React versus just Laravel. So we have the option to do to do React
and I'm fine to like walk through that or we can do something like Livewire which is going to be more the backend focused. Um let's actually let's let's do React. Let's do React. Okay. I'm happy. Whatever the true experience is, you tell me that. Yeah, that's what I want. So, it's one of those where like it it's it's not uh if you've ever worked with like an SPA where you're like connecting APIs and like doing it backwards, like
stuff like that, it's not going to feel the exact same. Um because inertia which is the glue that ties this PHP backend with your React front end together. You don't have to worry about APIs and um like cores requests and all this. It just works for you. You basically just send stuff to the front end and then request stuff from the backing kind of thing. So, it's a nice it's a nice way
to like show the full stack piece where Livewire would probably be more like theastro and you have like your d-server stuff in the top. Okay, that's where LiveWire probably feels a little bit closer just with a different syntax. Okay, so LiveWire is more like PHP front end and backend and we're choosing a React front end and a PHP back end. Yep. Yep. React React is strictly React and this is our starter kit. So, it like has
a lot of stuff out of the box for you. Um, let's do the built-in authentication just for easy. Uh, we're not probably won't get into testing, but this is kind of like the difference between a um a kind of like a a mod modular uh kind of functional syntax versus a class-based syntax. So, pest is usually the one that is probably more popular right now. Pest like just but for PHP. Pest like just
there's a lot there's a lot of P's. Yeah. Yeah, no worries. That's cool. So, yeah. So, this is just like starting a you know, new project or anything else. We've installed Laravel globally. We're using that to basically kick off a new project. Yep. Exactly. You've got it. We're all of this right now. Um especially like that Laravel new, it has those starter kits that we kind of give you out the box that makes it a lot easier. Of course, we could start from
scratch and install um you know, Inertia and React and we could do all that, but the starter kits make it easier to be like, "Okay, you can get up and running. You can just create a new page and you have like this information ready for you." Okay, go ahead and install here. Yep. We can go ahead and install there. Um running build. Does that mean is it building the back end or something like And then we'll run the back end in like a preview mode or Yeah. I'm curious why
it's building already. I think the reason I could be wrong on why we build it here. I think it's more so that when you do start you don't have to necessarily run npm rundev because then the then the assets and everything are already enabled for you. Um it did a lot of stuff. It did a lot of stuff. We have a lot of stuff. This is probably the piece that most people especially new to Larel and coming from something especially something like Astro but even
something like Nex.js or something like that. it. It's a lot of folders to look at from the get-go where you're like, "Oh, this is very this is very confusing." Um, yep. Composer rundev. That should basically uh create So, this is doing a couple things in the background. This is front end and back end. Okay. Yeah. So, this is running. No, you're good. You're good. I like I like when you when you jump in like that because then like uh it gives me an idea of like, oh, you already see like what's
kind of happening. Oh, there you go. You're back. Sorry, I lost just a second. And then you sped up real fast. Oh no. See how fast you were talking. I lost you for a second too, but now you're back. Um, let's do So yeah, basically this is running PHP Artisan serve, which is basically like the PHP server for it. And then it also runs npmu that command. So it's using MPX concurrently to do all that.
Okay, so this is the back end. This is the whole Laravel application. Okay, so where does the React fit? I mean obviously I'm guessing this is using beat so Mhm. Um I'm guessing this is like the front end side of stuff. Um that's actually just like the V development server. So technically the front end like uh that that welcome page is is all of Yep. That's everything react assets being rendered to that page. Um,
so this is the part that basically like got me excited about Laravel from the first part is um like in that page right there we all we have a built-in authentication and everything. So if you were to like um it's using a SQLite server in the background. So if you were to like uh try to register we can like everything should be up and running. We already migrated all of our our database options like that's part of like what that starter kit installs. Um but
basically uh this this gives us a starting point now with like this starter kit to be like okay um and it has validation out of the box. So I nice um that's what I get for trying to do a really um really simple password. Yeah. My password right now is password. Don't tell anyone. There you go. Password. That's that's why I usually do like
testing password. I think mostly because uh I I don't I don't know why. Um this is just local to my project, right? Yes. Yes. Okay. As long as I'm not sending my password out to the world. It's already deployed on Laravel cloud. I'm sharing it to everyone. Okay. Um so can I see the database then? Like yeah, let's SQLite database. That is a SQLite database. Okay. So where's my users? Oh,
look at this. Does it hash it and everything? That's cool. There we go. It's hard to argue that. Okay. Sorry. No, you're good. Um, let's let's take a look at that database folder then too because I think like that's the part that um cuz you how how familiar are you with like full stack frameworks in general like Rails Elixir maybe. Yeah. Loosely. Okay.
I think like that like the the the difference in migrations and models when it comes to interacting with the database is probably the biggest thing that I was mostly confused about when I was changing things up. So this is what was generated for us all these migrations. Um and I think one of the things I I like about PHP and one of the reasons like I was I was trying out PHP and Laravel and I was trying out Rails
and I was trying out Elixir and Phoenix. I I mostly was like, "Oh, PHP it looks more readable to me than Ruby in a lot of ways." Um, which is funny because people say like, "Oh, yeah, Ruby is like super easy." Uh, but like I take a look at this schema create and I know what's happening even if I didn't know PHP. Um, and so basically, yeah, these these
migration files are created one piece after one piece after one piece. Um and so it goes kind of in top down order. So if we were to create a new migration uh or a new migration file and the cool thing is all of this files that we are going to like touch and create can be done using like a CLI. Okay. Um to make it easier go back here. Yeah, we
can we can do that. Um let's let's uh let's create a new like uh let's create a new model and migration actually. So if we create a new do I have to kill this or should I just open a separate panel or Yeah, I think opening a separate panel is perfect. Okay. So the CLI within Laravel is PHP artisan. So if you do PHP space artisan sorry oh space okay and then we have a bunch of stuff available to us for here. Most of
it's going to be prefaced by make. So if you do make colon okay um and let's do let's go ahead and make a model. So if you do make model a space and then we can call this uh with a um a singular case. So we can maybe uh call this I don't know a post like a capital P post. Okay. Uh is that just convention to capitalize it? That's more just convention. And I think the artisan command also like takes that and uses
that for stuff like migration. So if we do a dash m as an option after this. Okay. Um, and then we probably also want to do a let's do a dash M and then RC like that. Actually, and we can actually put that all in one option, too. Okay. It probably works the other way, but Yep. Exactly. Um, run it. Yeah, let's run it. Something happened. Something happened.
All right. Looks like maybe over here. Sweet. Yep. Right. Right there. We basically three files were created. We'll take a look at all of them. Uh but here is where we can basically uh generate our schema for posts. Um so why don't we here let's let's do like maybe like a a title and then maybe like some text. So if we do like down here um and you most people probably do it like it doesn't really matter because this is
just order of like where the columns are in the database. Um but most people do it between the ID and time stamps. Okay. So I would say we could do a yeah table and then maybe like a string. So just string like that. You got it. And then we're going to do parenthesis. And here we can pass in a an actual string as a as a parameter to name it.
So if we do um we can call this I title. Okay. Perfect. And then it looks like semicolon. Yes. Exactly. Semicolon. Perfect. Semicolons are enforced. Semicolons are yes, you have to have them. No automatic added. Okay. There there is like uh there is tooling um that gives you know things like even
even within like VS Code and stuff like that there's there's there's tooling that will automatically add them to you, but they do have to be added. Yeah. Before build before runtime. I'm I'm a semicolon guy, so it's fine. I just want to make sure. Yep. Exactly. that that's the one thing I always forget for the most part. Um, and then we can add a uh so just to kind of say like the this
table and then anything after it like um uh is going to be the vary the the type of the table. So there there's things like text basically anything that you might think of like for for a database there is like enums there's um and the cool thing is like even though we have our setup as a SQLite database within Laravel right now if we were to
take this and to deploy it uh it's basically changing like an environment variable to change it to something like Postgres or change something my SQL and outside of like these those rare columns that maybe aren't supported or something like that there's nothing else that you have change within your database or your your code I should say. So it's like this in between layer that does the conversion process for you. Yep. Exactly. So it's like it it's it's part of the O tech I think technically the
migrations would be part of the OM which is called Eloquent within Laravel. Okay. Um so this this is all like using Eloquent then. Yep. Y like that syntax. Okay. Exactly. Exactly. and and and so if I want to do like a date like a actual like typed date, is there a way to do that? Um Yep. So like there there is a there's a date format. Yep. Okay.
And so then it would be passing like the the name of that the title. Yep. Or like I don't know pub date or something like that. And that would just title the actual database over here. Do I have So I don't actually have one here where I have to rebuild. Yep. Yeah, ex you got it. Exactly. So after we're done like with it, you you would run PHP um artisan migrate. And so that's basically telling us, okay, let's find any old
files that we haven't been migrate. Yep. Okay. So now we should see that in our database posts we did things pub dates there titles there. That's cool. Sweet, sweet, sweet, sweet. Yeah. And and that the migrations probably aren't eloquent. We can like if we were to go into maybe let's go into our um our app folder up
there at the top and if we go into we can take a look at an existing controller just to see like how what this eloquent kind of looks like. If we go to HTTP this is what's already generated for us for the O. So if we go into O controller and then let's do uh let's do the new password controller. That's probably like a good one to take take a look at. So again, this is stuff
that's already being being generated for us. Um, here is where that inertia is basically going to be that that react glue. So anytime you see like an inertia colon colon render, a name space that is being created that second parameter that that um the title is going to be okay, we're going to render this specific React page and send as props the reset
password array. Okay. So, that's what's happening there. Um, I think further down we might see more. Yeah. In the store. Um, yeah, a little bit lower probably. So, we have this request to validate, but um, okay. Most of this probably isn't as much eloquent stuff. I was I was going to I was going to show you. Let's do
Let's do verify email controller. See if that's okay. Sweet, sweet, sweet. I don't know what I'm looking for, so I'm Oh, that's the end. I was going to say I'm just going to keep scrolling. No, you're you're good. Yeah, I was I was I was trying to see if there was a good spot to show you like um Eloquent. So, basically like Eloquent maybe similar to like any kind of database, you know, OM like Drizzle, Prisma kind
of thing. Uh where it's very um it's very readable and user friendly. If we were to say like, hey, give me all the posts and like let's send it to a to a React page. Um, it's as simple as post colon all and then like that that that's that's grabbing all the posts and that's
actually sending them as specific um um like in in that same eloquent model format that that React or that uh Inertia and that Laravel kind of expects. Um Why don't we jump into the front end and then see what see what's happening there. So we can close out that app. Actually I lied. Before we do that, let's go back into app and let's go into uh models. So that's there we go. And so we have that post model that
was what was generated for us. We did PHP artisan. Then we have our user. And then so this is where and again this is probably like the at least functionally this is kind of like where the the biggest change I think when we're moving from kind of like a I don't know a a front-end focus stuff to like a full stack is like you have the migrations and those those dictate
your schema for the database but the models is where it's dictates how do they interact with everything else. Okay. And so a lot of these models you see here like this casts in the user and you um this is where a lot of those things if you wanted something attached to the user model to make it a little bit easier a lot of helper functions are generated in here. If I wanted to say um I want I want to get all the users posts
and I'm make that easier instead of having to write this eloquent uh or like SQL to grab all the posts from a user. it it's easier to do it here in the model and then we can use it later. So we can even do that right now if we go into um like just after that protect function or some anywhere where there's empty space within that initial uh array or Okay. Yep. Right there object like
right here. Yep. Perfect. Um and we can run we can we can uh we can make it a public function because we're going to we can probably call this from a controller. I'm guessing I type public. I I should have probably asked. Okay. No, you're good. public function. Yep. Exactly. And then we can call this uh why don't we call this uh posts and this will be like all lowercase. Yep. And then that's going to be perfect. And we can This is an array. Yep. Exactly. So
this would be like um actually it's probably not going to be an array. It's actually going to be a um uh it's going to be a belongs to um and so Okay. Yeah. Uh, it's part of the ORM like just you can Yeah. And actually, while we're here, why don't we install like the Laravel uh VS Code extension to help us out a little bit. Okay, that'll work. That way I'm not to
remember it all off the top of my Perfect. That is the one. That is the one. Yes, of course I trust them. Yeah, I I trust you. I trust you. Okay, so something's happening. That's good. So, we'll try again. Download binary. It's thinking about it. Binary download belongs. Do I have to maybe um reload developer window? Maybe. Let's
see. Belongs. I use like different uh code editors depending on what I'm doing. So, open in a couple weeks. So, yeah. Yeah. actually the belongs to like that that PHP type uh type hints are probably going to not be Laravel in specific that's actually more like PHP specific. So if you go into extensions probably the best best one is PHP intellence.
Yeah, that one like fence fence. There you go. Yeah. Okay, man. The pun game is very strong. There's a lot of PH puns in PHP. No shade. It's just I like it. It's I'm a dad. So, you know, that's where we roll. Exactly. I I feel that. I feel that. There we go. That belongs to Okay. And actually, uh Christian on on YouTube, correct me. It is not going to be belong to. It's going to be has many
because we're in our in our users. Okay. So, one to many relationship. Get out of here. Stop telling me to do stuff. All right. Has many. Perfect. Then that will be that will be an object. Okay. Um so, actually, you don't uh I guess you you could do that. Uh this is another weird thing is like PHP developers like to have the uh this um no just the object on the following line like if you see on
line 44. Okay. Oh yeah. I don't think it matters for building it but it's just readability. Yeah, I guess I guess that's readability. I actually I I go back and forth. I probably look like a weird PHP developer because I sometimes have it. Uh but now I write JavaScript like this though, too. So that's even weirder, I guess. Um, that's why we have biome. It's for you. Don't worry. Uh, oh yeah, I like I
like biome now. Um, yeah, nice. It's replaced a lot. I wish it did more uh better stuff with HTML, but I think they're eventually going to get there. So, yeah. Yeah. Um, we'll go ahead and return. And then this is where we can do um I think it will be just be let me go. It should be users or uh should be um it should
be and actually uh that is that is why we probably aren't aren't getting as as much typins because we can actually say that a post can belong to a user too. So if we say a post can be belong to a user then we know in in the database then we know that um we can create it there. So, one thing, um, let's actually go back to our database migrations. You're going to have to help me out there. Um, it's in the database database
folder. Oh, that's right. Database migrations. Oh, okay. Go back to here. Sweet. Yep. And then um after that, maybe maybe even after that ID um what we can do uh is table probably. Yep. Table. And that's going to be a foreign ID.
Okay. Perfect. And then like a relation like in Drizzle or something. Exactly. Exactly. Relationship whatever they call it. Yeah. Perfect. Um Yeah. And then in the uh then it should be a user I believe. Let me go ahead and make sure here. um user uh actually I think it's user ID
so basically the foreign ID like this though um actually no string it would be the string yep okay yep um and then after that we can say constrained so this would be like the arrow syntax so instead of the the dot notation this is PHP's ways of doing dot notation okay characters I don't know about that that throws off the whole game I just can't do that and Then I was in it for
till that constraints. Uh yeah, constrained and then that's a a a method as well. So like a parenthesis to do that. Perfect. Now if we were to run PHP artisan migrate again and we're going to actually run PHP artisan migrate um dash dash uh or actually colon fresh colon fresh. Yep. And so this will drop everything and rerun it. Because if we were to run a start, it wouldn't it
would see posts are already created. So it's not going to find that other column. We would have to the correct way of doing it would be to create a new migration table. Okay. Or new migration um uh field I should say. Okay. I like dropping tables. So it's good. Yeah. Especially in production. Yeah. Um sweet. So now if we go back over here, we should have help. more help.
Yep. Um and I don't know if how much PHP IntelliSense or or maybe I'm just been relying on Copilot this whole time, but if we do return um and this is where the dollar sign comes in. Okay. So, we're going to return this. So, this is basically saying we want to return um the uh this instance. Yep. This instance of user and then not do this. Yep. You got it.
Then this is where we can do the uh actually not so uh I meant that this is referencing the user. Okay, got it. Um and then arrow and then it's going to be has many. So yep, camelc case. Perfect. Has many. And then this is where we can pass in the the class of the model. So instead of a string here, this is where we can actually do uh uh to uh like a
post. this guy right here. Um, and that might actually have been the wrong one to bring in. Let me see. Post. Um, oh, that's a one. And then if you just do, we'll just do a a colon class to say that this is going to be the class instance of the post. Okay. So, this colon syntax like what is that map to? That is a good question. If dot
is this Yeah. colon colon is just like we it's what Russ stole from PHP or that's a good question. I I I'll see if anyone in the in the chat maybe Florian if you're still here you know you are a PHP master better than I am. Um but the way I understand what this colon is doing is it is referencing a namespace within that. So I actually don't know if there's a onetoone reference within
JavaScript that I'm that I'm thinking of. I guess I guess a class within within JavaScript. I guess it would be the closest, but that that's referencing um like new instance or whatever of the class like I'm instantiating. Not really. I guess if you're Yeah, I don't know. Yeah, not really. It's probably just because if if we were to just have the capital P post, it's not referencing it at all. Also, if we were to go up to the top when like
PHP and actually because we're in the same name space, we don't have to use this use, uh, blank that we might see at the top. Okay. Um, uh, James KH on, um, Christian and YouTube says, uh, what was that? Sorry. Oh, I deleted something that had this belongs to. We don't need that. Yeah, we do. We do not need that. Um, it is a
static method. Oh, okay. Static method. Um, yeah. And if we were in a different double colon is Yep. Yep. Double colon is static method. Um, yeah. And the weird thing about PHP is is if we were in a So, we are in the name space there at the top of app/models. So, we don't have to import that use function of of uh the to-do the
post because we're in the name same name space. But if we were to try to grab this post in our like a controller which is a different name space then we have to actually call use app slashmodel slash to-do. We would call that down here like inside this um you could do it both ways actually. You could do you could do like a full namespace of like slash app/most for example um and that would
reference it or you could bring it in at the top um kind of like similar to like a import function within Yeah. within JavaScript. All right. So what is this given us then? It's now giving us a function to be able to call all the posts that belong to this particular user. Exactly. Basically. So it kind of like created a API route for that but like just for our application. So it's not as magical as that. That that that would be that would be nice. Um this is basically just giving us a function that
we can call within our controller for example. Um so if we were to go back into like um that uh at the top there that like app um HTTP controllers if we were to go um let's even do our like just yeah let's do the off and then maybe like that. uh or let's do yeah off settings controller.
Okay. Um and then like profile controller. So it basically just gives you the ability to okay in this request now like in that array that second array parameter of that setting/profile render I could say um give me all of the loggedin users posts pretty simply. Um, and what that would look like is uh um
posts. Yep, that could be exactly it. So, post and then we could say uh and we actually um don't even have to do like a request because inertia um is kind of like like this magical glue where we don't have to say hey I need to make sure that the request user is it. Um we can actually do like a o a capital a off or even a helper function there and we pull that in. This is the class base. So
this is going to be colon colon and then we can say user upper case lower case uh lower case just like that and it's going to be a a method. So, parenthesis. Okay. And then here's where we can say uh this is the arrow and we can say the posts inside here. Um after the after the user after y okay like that. Perfect. Yep. And then we can
also colon there. Yep. Cuz that's the function that we created. Uh colon or comma or nothing. Uh it doesn't need a comma. Yep. The last one doesn't need a comma. Yep. It's an array. Okay. What's going on down here? undefied method user. I guess let's leave it alone. It's working. Um, just don't look here. I'll scroll up. But yeah, this is basically how you would reference that within a
controller. And we can we can delete this cuz we probably wouldn't want this in the settings profile of of a user. But that's basically what we defined in the model is now what we can use in our PHP within a within a uh you know within a controller class that our front end is calling or that it's being received from our front end. We can now just grab all the posts as well. This is like a git
collection for this user. Sorry, I'm going Astro on you. No, go for it. I like And you're getting all their posts and you're filtering it by the user who created it. Exactly. You got it. Perfect. Um, let's jump into React for a little bit. I don't know. How much How much How much How much time do you have? I know you said uh I have about an hour from now. Yeah, I got an hour more. Sweet. I got a hard stop. But is it 9:30 for you? Um, it is You're Phoenix, so
you go It is 8 8:30 a.m. for me. Yeah. So Oh, it is. Okay. I'm I'm fine. At at 9:30 your time. Sweet. I like it. Um, yeah. Yeah, let's jump into uh and we can remove that that post now that we we don't necessarily know. Yeah, now that we know, let's jump into React and take a look at kind of like what's happening. A lot of the stuff is going to just be feel very familiar, but we can take a look at what's actually happening here. So, all the React stuff is given in um
uh we can take a look at routes first. Actually, let's do that because you clicked on it. Let's do web. So this is uh mo those four files are mostly just conventions like you you don't have to have like these oh here's off.php which contains all of the authentication routes. It's more just for v like visibility of like instead of having one large file. Um okay it it's saying okay let's grab all the off ones
and let's put them in their own separate route just for simplicity sake. Okay. Um but this is the the uh filebased or namespace based kind of routing where we're saying um when we have the slash route we're going to return inertia render and it's going to be that welcome page because we have that Laravel function we should be able to like uh
commandclick into that welcome and we should get taken directly to okay the welcome page. Perfect. So this is actually under resources. Resources. Okay. Pages is welcome. Okay, cool. That's a that was a little bit tricky for me when I first cuz I was like I was like that doesn't make sense to be like in resources and then JavaScript kind of thing. Um and that that's customizable but it's more a convention of like okay this is all the JavaScript that our
application is serving and within that we have components and hooks layouts lib and then pages as well. Um but basically that that's uh in in that route when we called that welcome it's looking for the welcome uh name within the pages directory by default and we can you can modify that if you wanted it to be elsewhere but we didn't have to call slashpages/welcome it's just welcome
okay um yeah the the starter kit gives us shad CN out of the box for react so it's feels very familiar here. And yeah. Yep. Uh I I think I think there's all our chats and stuff. There it is. Nice. Um yeah. And then so in that welcome page that's uh const O off prop that's
probably like one of the things like to to talk about for uh one of the inertia helpers that is basically given that use page from inertia is basically saying custom hook. Oops. Yep. Exactly. Custom hook to be able to say there's some things that we want to have on every single page. Um and most of the time it is uh it is off. It's
saying hey I want to like have the ability to say what is like who is this user that is currently logged in. So that way we have that information available to us without having to have any other kind of API call request every single time the page loads for example. Okay that's kind of cool. Yeah. And and and in that shared data um I actually don't know where it is off the top of my head. Let me take a look. Um, I'm guessing too like all this is
server rendered by default then if you're calling getting the off here or is it just passing down the user? Yeah, I'm curious like where this runs. Yeah. Yeah, great question. Um, so inertia is all going to be client side. So it does uh it does run um basically the the routing and everything is happening on the server um where it is grabbing any kind of like props cuz you're you're never calling for props
basically in React. It's not like there's no server components type stuff where you're calling for specific things. Um it is grabbing that information like from post or users on the server and then passing it to the client after it's already been rendered. There is like server side rendering inertia that you can easily turn on. It's basically like a couple of lines of like configuration to say okay we want this server side. At the moment it's
just one or the other. So you can kind of either choose do I want everything client side rendered or do I want everything server side rendered. Okay. That being said, a lot of people kind of do like their application in and even in Laravel like applications like our official Laravel applications, we have like the application in React or Vue and then like the marketing pages would be all server rendered um what we would
call Blade. It wouldn't be React as the templating language. Blade is Laravel's. Aastro for example. Okay. So, is that per page or per project? You have to decide the rendering strategy. Per project. Per project. Yep. Split like where you have one that's pre-rendered and one that's not. And Yeah. Okay. Yep. And there probably is. I don't know if people have done it before and I don't even know if it's
actually possible, but I I I bet there probably is. So basically when you create a serverside rendering um entry point you're saying uh all of these pages in this directory are server rendered. I bet there is a way to also say then these pages are not server rendered. Um I don't know if anyone's done it honestly. I'd have to that'd be now that I'm thinking about it I'm like I'm curious
if people do. Um, but yeah, like uh current for the most part most people are it's per project based kind of thing. I'm seeing here that there's like a head here there's no shared layout or anything like that. Um although I'm seeing over here you got like this app layout off layout settings. So like how does um I guess here you have got this app layout but here there's nothing. So like
which layout is it just using like a default layout? Um for the for the welcome it's it's Yep. For the welcome it would not have there's no layout spec specified there. Yep. Yep. So um yeah similar similar to uh there there is no there is no page based or a file-based routing simp templating
system where it's like um hey this is my template and every single page I don't have to do the import that layout it it's just more component based. Okay cool well where should we go next? What else? Why don't we uh place to explore? Let's do let's do um why don't we do a let's let's create
a new page and um let's make this maybe maybe we'll make this uh posts.tsx and that way we can kind of do that. Um, and then why don't we just copy everything in the dashboard for right now just for simplicity sake and we'll just kind of paste it over and change change a couple things. Um,
oh, sorry. I messed everything up. There we go. No, you're good. You're good. And then uh we could probably maybe I like it. Yes. And then let's go into that that app layout. And we can change like the the sidebar. So into this file here. Yep. And then uh app layout template.
Okay. And then the sidebar right here. Got it. Perfect. And then at the top we have like uh kind of like the the stuff that's being rendered. Um so I should probably make this visible. And maybe I have to relog in. Um I think because we migrated fresh, we have Well, you'll have to create a new account. Yep, we dropped everything. Oh, that's
right. Dropping tables. All right, let's try it again then. What? Did I lose you? Nope. Okay, you're good. You're good. Okay, cool. All right, so we have this here. And that's what we're wanting to add is another one. Is this link a helper? This is just from Oh, it is a helper. So, it's like a routing. And we
basically just have to you uh the the way that the uh template set up is we actually don't have to do that actually. Well, I killed it. Sorry. Um uh yeah, if you remove that then if you go up to top the main nav items are actually its own uh its own object. Oh, okay. Yeah. So, we can just add um next one. And actually this this would be nav items for the bottom. That's like a footer now. We probably don't want it there.
There we go. Okay. So, here we change this to posts. Yep. There you go. The icon is something else. Do we have IntelliSense here? Yeah. I don't know if we have IntelliSense there. This So, this would be like shad CN type icon. Oh, like Lucid. Okay. Yeah, like Lucid. Okay. All right. So, I did that. Sweet. So now we just have to make sure we add
a route too. So like that's that's that's the that's the piece that it is like it feels a little bit more separate mostly because it's it's it's very still MVC type structure where we're like okay we need we need a route for this slash post if we go into or it won't render like the button up here or whatever. Uh so we do have post. Okay. Yeah. Yeah. Yep. I got it. Okay. So go back to where now if we go to
web.php. Okay, perfect. And actually, yeah, web page is perfect. Um, we can uh in that in that group function um where that route dashboard is, we can actually just copy um that like route get Yep. Uh and all the way through like the through the name. Yep. Then we can dup duplicate that and we'll just change can just change everything to to post. Perfect.
Awesome. So what that is doing is that name that it's showing that that that it's giving is then um also allowing us to instead of for the pieces within um PHP and even there's there's some things within um React and inertia like helper functions that we can use there's things like wayfinder or ziggy um those are separate packages but mostly that post allows us to then use a named parameter
instead of saying slash posts whenever we want go somewhere. Okay. So, we can see the dashboard. Yep. Exactly. Like let's redirect to post or whatever. Yep. Exactly. Exactly. Okay. Um, sweet. Perfect. So, now we have that
being rendered. So now we should be able to uh why don't we get some uh fake data going in our post uh migration and then we can get it all. So here's here's the here's a way to kind of like do this the the uh the Laravel way would be let's pop open our
our code editor or our terminal again. We're going to do PHP artisan um make and then we're going to say factory. Okay. And this is where uh just hit enter. Yep. If you hit enter, it'll prompt us for us to to say like what it's should be called. So we can call this the post factory
camel case, kebab case. Uh whatever that case is. Yes. Yes. Cool. Uh oh, it looked like you did post factor instead of factory. Oh, I should should be should be fine though. We can we can um sweet. Let's go into uh that.
Can I rename this now? Yep. Let's rename it. Post just postactory like this. Yep. Perfect. Post factory. Do we have to change anything in here? We should. Yep. Just have to change that that class. Yep. Perfect. Okay. Awesome. And so factories are basically what allow us to use like fake data. So we don't have to like grab any kind of like other package. We could just create our own like fake fake data to say when I seed the database with this factory, what
kind of information am I actually putting into it. And you can technically do all this in a cedar, but the factory is like the easiest way. So I think we needed a I think we said we had a title, a date, a date and an ID and a user ID. Yep. So, time stamps already going to be generated. So, we shouldn't have to do that. Um, so let's go ahead and do uh let's do uh if you do in that array,
we can do a a string. No, just string. Um, actually just just like the the title itself. So, we don't we don't have to talk call string. So, just uh yep, quotes title. And then this is where it's going to be the arrow syntax. Okay. Um, and actually, sorry, not arrow syntax. It's going to be like the equal
um equal arrow syntax. Equal equal arrow. No, one equal. Uh so space after title and then uh so it's going to since it's in a object it's going to be yes like the equal and then uh the right bracket or right arrow like this without the without the dash
sorry just the greater then yeah got it sorry um and then we can call uh faker oh just using fakerjs under and actually sorry not not not faker just fake fake fake perfect and that's going to be a method. Perfect. And then this is after after this is where we do that uh arrow syntax and then so we can say that that's okay.
It it happens. Uh and then this is where we can say what it's going to be. So this is going to be like a sentence for example. All right. So just like type the word sentence. Uh yep. Type the word sentence. And that's also going to be like a Yep. Perfect. Um, and this is going to be a comma. So, every perfect pub date I think was our other one. I
think we called the pub date. Yep. Fake. Fake. And that I think we h I think we can call that maybe like a date time between might be good. Okay. That that way we can say um this I believe gives us two parameters. So we can say like it's going to be like maybe I don't know minus one year. Okay. And we can actually do like uh natural syntax here. Oh, nice. So, minus one year. Perfect.
And then it'll be a second parameter as well after that. Um actually a comma in that method. Oh, okay. In here. Second parameter. Perfect. Perfect. And then we can say now like uh sentence uh as a as as a as a string. Sorry. Okay. Perfect. Okay. And then last, we just need the user ID.
Oops. Right. So, user underscore ID. Underscore. Yep. You got it. You got it. And then this is where we can also call like a user um factory cuz we already have one created for us out of the box. So, we can actually this will be um a and I think we might be able to do this as a class-based instantiation.
So, if we do thing uh user colon factory, we should be good. Okay. User like this colon. Oops. Factory. Yep. Factory uppercase lowerase method. Uh should be a method. Yes. Yes. Yes. Maybe we don't. And let's pull in that uh do I have to pull it in that model? So, this is what you were
speaking of earlier where you have to import it because we're in a different name space. Yep. But I think I think Yeah, that should be that should be that should be right cuz if you if you search for uh user factory I I think starter kits have a user factory in it. Okay, we do. Perfect. Yes. Okay, awesome. So, we are good there. And then
so that should be everything that we need I believe. Um let me think let me think that should be everything. Uh oh I guess one thing that we that we do need is if we go to the uh post model. Okay. um we need to make
sure that this information is a lot of this is basically just making uh being being secure so that it makes sure we don't shoot ourselves in the foot and all these like conventions kind of like are like okay we need to make sure that this is built for applications in a sense. So like what we have to do here is make sure that um this uh model one can use a factory and two uh there that
information can be filled into this model. So it's allowed to be to be fillable. And so what we can do here is um in here we can say use right inside here upper right inside here lowerase and then we can say space and then it'll be has capital capital H has factory. Okay. Um and this is actually that's actually just no method just a colon
after that. Okay. Uh I'm sorry semicolon semicolon. Perfect. Um, and then uh couple spaces down here. But what we can do is do a protected fillable. So protected and then it's going to be a dollar sign fillable. Okay. So this is a uh what does the dollar sign do? So that is like the the actual um name of the
like the the name of the uh variable. And because fillable is one that is a is a reserved variable in the model like the eloquent model that this class of post extends then we can say okay this isn't like creating it from scratch the model is actually searching for this fillable okay
variable. Um and so in here this is actually going to be an array. So just like that. It'll be equals equals array. Yep. Like this. And then space. Yep. Space array. And then uh if we open that array up, we'll go and this is where we can input each field that we need. So we we need a title that uh pub
date. And this is going to be colon. Yep. Pub date and then user ID. User ID. Perfect. Then we can semicolon at the end of this array. Okay. Perfect. And then the last thing we probably just to make things easier for us is any date. Usually we want to make sure we cast it as a as an actual date time. So um and this is mostly just to make it readable within
eloquent for as a date. Um so after this protected fillable what we can do is uh a protected uh dollar sign casts. Okay, perfect. And that's also an array. Oh man, I was hoping I got that right. It was you you're you were spotless. I didn't even see. Um and then it's going to be pub date
uh as a yeah as a string. And then it's going to be a the equal greater than sign. Got it. Of a string of date time all all lowercase. Okay. Perfect. And then we can yeah do a comma and perfect. And then we might as well also use like the throw in the that public function user here too. So that way we're referencing in both places. We can
call like give me the post user and also give me the users posts too. That's public function. Um, and then unders under space or or lowercase user. Okay. As a method. Then the return type. And so we we can do a colon after this. Return type is going to be belongs to capital
B. Yep. Perfect. And then this is where it's going to be an object. So curly braces. And then Oh, wait. I forgot PHP. Is that good? You're nailing it. I like it. I love it. I look like part of the family. Yeah, you're you're you're in the you're invited to the cookout. Sweet. Um and then we can
return and then this is that dollar sign. This okay. And then arrow syntax belongs to right. And then this is where we can pass in that user colon class. Oh, that's right. User colon class. Perfect. Then semicolon because we're in this name
space. Uh semicolon after the after the method that not here or also here. Um not there. Okay, perfect. Yeah. So, yeah, I like it. So, this is basically setting up the ability that we can use a factory, that we can make it fillable in this case, like this this fillable is not just for the factory. It's also for um if we were something in the controller that our React app is doing
as well as the cast to make it more readable. If we wanted to say like um basically Eloquent has what extends from Eloquent is something called carbon uh which is basically like user like easier to read dates. Um, and so we could say something like um, you know, if if we are saying when this was published, we could send that information to the React app by saying instead of it being uh, a
specific datetime format and then doing that calculation on the front end of this is oh 7 days ago, Laravel gives us the ability within eloquent to say just give me readable human format. Okay. Within that date time, that pub date. So what's the typing situation in PHP itself or in Laravel or are they the same? Uh yeah, I would say the the there's not too much that separates
Laravel from PHP within that typing specific thing. Um within the starter kit, for example, we do like lean into Typescript. We kind of we kind of already saw a little bit of that like we um and there's stuff that is being created by the Laravel team to help that within the front end of like of of there's there's a new package that just recently came out called Wayfinder where it's basically like hey all of the the
things that you're doing within um calling actions or form actions or calling uh routes and stuff like that it's a lot easier if they're typed on the front end instead of having to figure out what they were on the back end. And because we know they are on the back end, we can do it. So like right now it's maybe not as great as it could be in that kind of back end to front end divide. Okay. But within PHP and Laravel, like specifically on the server, I would say there there's quite
a bit of type safety especially like this this. So there's return types that we kind of see here. Yeah. Um, and then there's also like within any kind of class or with any kind of a um a model or anything like that, we could also add additional types and even like PHP doc, which is kind of like JS doc type syntax. Yeah. Yeah. To say this is exactly what I'm expecting here. So I
think I saw that somewhere um I don't know in one Yeah, probably in the Oh, no, that wasn't it. I don't know. I saw it somewhere. Yeah. Yeah. doesn't look like JS doc and I was like hm I wonder what that is but yep exactly so it kind of is up to the individual and there's like there's uh kind of like how oh sorry go ahead go for uh kind of like how biome like allows you to be like okay um I might get this completely
wrong cuz I haven't used biome that much but I like specific syntax specific configuration within like es biome stuff like that allows you to say this is how strict I want it to be and this is how non-strict PHP does have stuff like that within uh things like recctor um or even uh PHP stand which is like a static analyzer static analyzer okay that basically allow you to say okay how strict do we want to type like
everything should be like at least have a return type that's usually what I think most people kind of lean towards when it comes to when it comes to PHP types like I I'm not a huge type person but okay I like I usually do PHP like a return types. That's like my my go-to. Okay, cool. All right, so now what we've done, let me make sure I can talk back through this. Yeah, so in this model, we've
basically said it's allowed to use a factory. Here's where it should store the title, pub date, and user date within the fillable like reserved uh uh yeah, constant or I don't know what that would be, just variable. Um, we're casting and I'm guessing this is another like this is basically saying I'll grab all the types and let me update this one to be a date time. Yep. Exactly. Okay. Yep. And then we're tying this is what we did earlier in the settings that was like it probably doesn't make sense in
the settings but here it would make sense for the posts to say I want all the posts by that user. Yeah. Okay. Yeah. So then with the post factory can we say how many we want it to create? like it'll just create 10 or whatever and using using faker whatever it's using under the hood for this fake uh method. Yep. So now we can go into the if we go into uh uh database cedar. Okay.
Uh um yep there we go. Database cedar. So we can see here that like that user factory has been has been removed. Um like we have a we have a test user for that. So what we can do now is we could like comment both of these out and we can do a uh a post colon colon factory and here's where um we can uh kind of say that how many we would like kind of like what you're
mentioning. So that this this cedar is basically what um allows us to say then say okay we're using this factory that we created as like the syntax and like I said we could we could have written all this out in this cedar itself and not use the factory and we could have just called like this fake and everything like that within here but typically you would write the factory call the factory from the cedar then let the cedar do the work. Yep. Yep. Exactly. Especially
within large applications where you're like oh like within our Laravel cloud applications and stuff like that like a lot of times it's like oh hey here's 50 different factories just to get your local environment up and running to make everything like hey this makes it a lot easier to get from the get- go and that's pretty cool. I like that. Yeah, exactly. I think for me like the part that really like most of the stuff I do is like a solo dev. I'm like I'm not creating too many factories. Yeah. Except for like when I want something
like up and running. Most of the time I'm even maybe just doing that in the SQLite database myself, just like manually creating things. But when I want someone else to like open up and run this locally, it's so much easier. Nice to have a factory. Yeah, exactly. One command. That's a cool pattern. You create it and you're like, "Oh, I have all the information I need. I don't have to find all this stuff." And it's so powerful that we only probably like touched like the surface of it. Yeah, I
like the idea. I mean of just like yeah using which whatever it's using under the hood fakejs or whatever else like to or maybe not JavaScript at all I don't know but um to be able to like template stuff like that out makes it so much easier when you're learning something like you're not sitting around creating a bunch of random data. So yeah I like the pattern. So how do we get this to run? All right. So we can go back into our terminal and we can run PHP artisan
db colon seed. Okay. Bam. So, now something's happened. And if I go over here, I should see posts. We should We didn't get an error, so that's that's a good sign. Okay. Sweet. Look at that. That's pretty cool. I like it. It's all Latin, but yeah, I actually think I can't remember there. I think there are ways to tell fake to say like fake with like specific. Yeah. In
instead of using Laura Beepsum or maybe that's a separate package. I remember there was one cool way that I saw someone do it and I was like, "Oh, that's really neat. I'll have to remember that." And I never remembered it. There's probably so much stuff. Yeah, there's probably so much stuff that like like even even there's stuff like within uh that the Laravel official team, they'll they'll look it up and they'll be like, "Oh, uh like that is now like I I totally forgot like that
existed." Like it's just it just kind of lives there. How how long has Laravel been around? So, Laravel, I I believe Taylor created the first initial commit um just over 11 years ago and probably is even is even longer. When was the first commit in
Laravel? Um June 2011. Oh wow. Yeah. So, a lot longer than than 11 years ago. Um but yeah so it has been it has been I know it's a really mature framework so yeah yeah that's all I know cool and um like people uh started using it even even before he hit 1.0 I don't know. I think people started using it in
like production just to just to go. But like I think I think Laravel 4 was when a lot of people the was when the majority of the current code code base is probably um of course a lot has changed but like that's when the biggest changes happened and a lot of people came kind of into the framework and I I think that was in um let's see 2013.
Okay. So 2011 to 2015. That's crazy. I didn't know that. Now that we've seated this, we've got the model set up, the factory is working, it's created all our stuff. Now we want to pull these into the actual post route, right? Yep. Is that the idea? Yep. Yep. I think the idea comes in as a prop. Yep. It would come in as a prop. Um, first we need to make sure we pass it, but yeah, it would come in as a prop that we can then, you know, deal with on the front end. Um, this is
one I'm not as familiar with TypeScript as I as I should be. Uh but we'll go ahead and start in the uh post controller because that's the best way to kind of make this happen. Um and why don't we do in the index method? So we this is when we generated that create that make post we said -mrc which basically created a migration for us and then a resource controller.
Okay. So this gives us all like excuse me all like this is the resource controller. Yep. Exactly. And the model is what we were just looking at. Yep. Yeah. Exactly. Exactly. This gives us like the the those seven crudish methods of where it's like, hey, create, store, edit, update, destroy. Yep. Okay, cool. And so this is typically like what most people, again, it kind of depends on like preferences.
Most some people prefer like single controllers, invocable controllers where it's like instead of having resource controllers, I just um I will just create the route in my web.php like we already did. Uh and then some people are like only resource controllers where if it's not one of these seven functions like then I'll I'll create a new resource kind of thing. So it kind of depends on like personal preferences.
Um, I think I'm all over the place when I'm when I'm doing when I'm doing React and stuff like that. Uh, but in this index, we can go ahead and let's uh create a new variable. So, we can do uh dollar sign posts and that can be uh equals and we can do post colon colon all upper uppercase.
Yep, there we go. And then that will be a method. So um and then a parameter after that. So this is basically saying give me all the posts and now we can push it into that that react front end. So what we can do now is um after that index or after that all we can go and return or sorry after that uh completely after the all. So like a couple spaces
down. Yep. We can return and this is going to be an array. Oh man, I was trying Very good. It'll be [Music] uh yep, return an array and then it's going to be uh sorry, not return an array. It's going to be return um inertia capital I.
Okay, perfect. And then colon render. So this is like the the static class from inertia to render. And then yep, you got it. Posts. And then the second array, second value uh of first parameter, yep, is going to be an array. So just an array like this. Yep. Perfect. Um and then this is where we can pass in that post. So we can say like uh like a string post like so
quotations posts and it's going then this is going to be that. Yep, you got it. Equal posts. Uh that's going to be the greater than sign after the Oh man, so close. Y but I do use the dollar sign. Yep. You use the dollar sign there. Okay. Perfect. So now I have a prop called posts that is all my posts being pushed into that page. Yep. So inertia render
here like this is already somewhere in something right like or no it's just here. Didn't we have like uh the web? Yep. So anytime that we are call So like we had that web.php PHP and this is where we'll have to then change that because now um we want instead of instead of rendering this post when we get this post we want to point this to our controller instead. So this this is the source of truth for what's what
requests are actually happening. We just create that controller to make this to to cancel this out. So what we can do is get rid of this. Yep. [Music] Um, and I guess like uh the easiest way would be to there's kind of like a bunch of different ways to do this. easiest way we could we can solve instead of route get um we can call route colon colon uh
resource I believe let's see resource let me see I always forget um and actually let's do it this way instead we we'll keep the route colit actually okay And instead of that function, so if we can we can remove that function as a
second parameter. And instead of that function, let's do a an array that has Sorry, I'm No, you're good. There we go. Array. And this is this will be the post controller. So capital P all upper case. Okay. Yep. Yep. Exactly. And then we can colon class that. And then the second parameter of the array is going to be
which so we want to do the index kind of thing. So this will be and and we'll this will be a string index. Y you got it. And so this is kind of like an easier way. We could have done like the post resource which basically wraps everything up and it says okay when I call a post or when I call a put to this post route I'm going to use like you know the the patch method in there. or when I call a get, it's going to use the index method.
That's an easier way to kind of like wrap it all up. I usually generally like to go for this where it's like a little bit more explicit of like, oh, when I get post, I want to make sure do this. Yeah. Yeah. Exactly. Okay. That way I am not confusing of when it's a put or a patch and all that kind of stuff. Yeah. No, that makes sense. So now over here I should have the post, right? Yep. You should have that. Like if we were to take a look at like uh the uh web Sorry.
Oh, no. You're good. If we were to take a look at like uh the um in your dev tools, we should see like that that being passed in like uh I'm guessing React DevTools. I don't know if I have installed on this browser. So, let me install those. It's probably when I use different things for everything. That's the right one, right? Can't even see anything.
One Nick Pony on Twitch. My favorite League of Legends player turned Larvine. It feels feels so long ago, but it also feels like yesterday. It's good to see. League of Legend guys, that's you. I that was I I played so much in college and so much after college. I even coach coached a college team for a little bit. Oh man, maybe I have to restart Chrome. I don't know. If I do that, I'm going to lose everything. So, we'll just I'll just trust you on that. So, sorry, I have it installed here. I
can't remember if there's maybe maybe it is just React DevTools that that that passes it. We also should be able to see it in um I should I should be following you along so I can follow it. uh like in I should I should have uh downloaded [Music] um let's see let's see let's see yeah I don't see it in here yet I probably have
to restart but then it would kill the stream so no you're good um let's go ahead and so now we can actually like access those uh actually like access those posts and And so what we can do is see if I can pull these in like this.
Yeah, look at that. Okay, so it is coming in. Sweet. And this is where I'll kind of rely on you for like how to how to like type all of this cuz like uh this is where I Did we get any help from the front end or we don't yet. So, this is something that I know that uh the Laravel team is is working on a lot to kind of make this a little bit cleaner, especially now that a lot of the official Laravel core team is is using React in day-to-day life. Um, it just
it's one of those things that it just hasn't been necessary a lot um or just not been what people are asking for, but it's it's one of those things that um is now I would say like front of mind, especially in these last couple years. Yeah. Well, we could grab all this and type this if we wanted to. I don't know if it's that important. Like I guess we get IntelliSense, but um if you're not used to doing that in PHP, that's fine, too. Yeah. I don't want to I don't want to
take up time since we only have a little bit left to type it all. But I mean, we can if you want to. Yeah, maybe we maybe we'll just uh maybe we'll just cuz we're getting it in here, so we can do stuff with it. Yeah. Sweet. Let's let's let's loop through it. Let's map it out. Get rid of all this stuff. here. And well, yeah, I'll just do something
like this. And then we're going to take our post map. We'll take each post. And then we've got the title. I'm allowed to use my JavaScript stuff in here, right? You're allowed to use Yep. This is pure React. No, not nothing fancy in here. All right. Let's just uh drop a a B. at all. So, we won't get IntelliSense, but that's okay. Oh, man. I got this new split keyboard that I'm still working on figuring out. Oh, no
worries. I I've always wanted to use a split keyboard. I have just not made the jump yet. I'm just an old man whose back hurts and so like having the split keyboard has helped my posture significantly. That and I usually stand when I'm not on stream. So, and walk on a treadmill. So, I'm just a weird guy with a split keyboard walking in my basement. There you go. I like it. I love it. So, So, yep. We could technically type this right here, but we'll just do any and
I'll call it. There you go. Call it. It already knows it's any, so that's not going to help it because it's yelling at me. So, yeah. I mean, we're actually getting the post coming in here. So, that's pretty cool. I like it. Um, and the neat Oh, that's kind of cool. So, that it just kind of gives you everything you need here. So, yeah. And the and the neat thing is there's there's so much within specifically because inertia is that glue. There's so much that like then you can do especially once you get into a little
bit more like advanced type stuff where um you know there there's things within like deferred props within inertia for example where let's say we had you know 10,000 posts that we were rendering um and we needed to of course we could easily pageionate those within within that uh controller that we're sending to this inertia page but we could also say that we want to defer it so it would not
hold up the rendering ing of that page and actually uh um and we would get the ability to stream it in afterwards almost or Yep. Exactly. So it'd be a deferred component that we would have in React that we could say, okay, here's inertia.js/react gives us a deferred component that allows us to say the fallback. This is the loading parameter, but that data I'm waiting this this deferred data is this particular piece
of information. So we could technically wrap that all in a a deferred component within React and and do that. So So we would just wrap it here. Yep. Exactly. And we would probably actually wrap it in um we'd probably actually wrap just the post piece because we don't want to wrap the app the whole thing. Yep. That's true. So just this part. Yep. That's kind of cool. So it's like almost like suspense. Yep. Exactly. More or
less. Okay. Yeah. More or less. I don't necessarily know what it's using under the hood. Um, and so I think I wonder if we get if if we can pull that in. But yeah, the fallback is going to be just JSX. Yep. Just JSX. Okay. Like a string of JSX. Um, I believe it's just I think I think it's just JSX. So you could just put the div in there. Yep. Okay. And just say like loading. Yep. Perfect. And then you
could also need one more thing. It needs one more thing of data. So data would be equal to props or the the posts. Yep. Okay, perfect. And I don't think we even need to have the posts in the initial prop right here. Yeah, I don't I don't believe so. No, maybe we do. I think we probably do. Uh loading
eternally though. Uh and then we need to defer it on the controller side as well. So if we go so if we go to post controller um instead of uh instead of that colon uh that dollar sign post we can say inertia colon defer perfect and that's going to be a
method which accepts a function. So we can we can do a single line function in PHP which is fn. Okay. And then a function. Yep. And then the dollar or the equal um outside of this uh fn array the equal greater than. And then this is where we can do the uh we can actually just call post all here just for simplicity. So we can remove that other
and I can get rid of this. Yep. Now I don't Oh, no. It is still named. So I'm just declaring it here. Yep. And assigning a name to it. Okay. So then I'd get it in here. Maybe. Did we break it? What did I mess
up? Let's see. Um, is there space after all? Oh no. Should there be? No. Now you're good there. And over here now it's just breaking the whole thing. This is no longer going to be here though, right? Yeah. I don't think we need that. Does it break that? Now it's just part of this deferred thing maybe.
And maybe I actually don't know if um post is not defined. Is it like data post now or um oh sorry the the the post is a as a string of data. So data uh and and not even in not even in JSX. Yep. That work
post is not defined. And and maybe we could add posts uh the prop back into the post function up here. Yeah. Still not working, huh? Now it can't map over it. Let's see. Now, you mentioned earlier perhaps props. Do I just say props down
here? Um, I don't believe so. Take a look.
Okay. So, I think we do have to I I think we do have to define then or maybe we don't. Yeah, deferred. And we're we're pulling in this deferred function, correct? Like at the top. That's a good question. Yep. Looks like we are from inertia. Posts. Okay. Data equals posts. [Music]
It's hard to debug on somebody else's machine. Sorry. No, you're good. You're good. Sure. If it was on yours, it'd be easy to do. Um Yeah. I wonder if it's um I don't know. I don't know what might be what might be happening there now that I think about it because we have
the data. Okay. Um and we have like the div afterwards and we're mapping the posts. Yeah. I don't know. Huh. What happens if I does it still load if I do this? Probably. I'm guessing. Or is it needs a child? But let's just replace this with like a div. See if it loads. Okay. So, at least it's rendering. So, it's just the fact that I can't find
posts. So, somehow it's not getting into here, but that's okay. I mean, I I understand it conceptually. It's like a server. I guess I'm the only part I'm curious about is like how that actually works in practice. How it works behind the scenes. Yeah. So, like um let me get all the way back to where we at. Okay. So, like this. And then I got to go back here and we'll replace all this. So we'll get it back up and and working. So
you know if I'm thinking if I'm putting on my Astro hat, there's like server actions. Yep. Where Oh, I thought I did it right. Oh no, that's right. Right. Just don't need this. Okay, there we go. Um, so you have a server action where you can go basically do stuff behind the scenes and once that data is
fetched, it then streams in as HTML and then it basically swaps that um live. Um, is that the same kind of thing that's happening or because we're in React land, is it actually like just giving it raw JSON or do you know? And then is it and then we're parsing through it at that point or Yeah. I'm just curious how it's like how it's returning it to us in a deferred state. Does that make sense? Yeah. Yeah. Yeah. I don't necessarily know what's under
the hood for the inertia react component piece, but for the deferred function on the on the Laravel side, like the PHP side, it basically spins up another instance of when when that boot loader happens on uh it it it's rendering the the thing, but then it's basically spinning up almost like a uh a one non not longstanding queue in a lot of ways
where it it boots up another instance of the of the request to finish out that task. Um, and so it's deferred technically doesn't work within uh like a lambda function for example where there isn't necessarily a sense of like a long-standing request. Um, so that's how it's working on the server. On the client, I don't know if it is like wrapping suspense. I would imagine imagine so if I remember some of the initial conversations, but I don't I
haven't looked into the actual the actual underlying workings as well. No worries. That's Yeah, I'll have to explore that. That seems kind of cool. Uh but someone did say they they were saying uh you need to for the deferred React to work, you need into there a component which receives posts as a prop. Okay, that's how React works instead. I guess that makes sense. And that's how the docs that's how the docs
show it where it has to be like a um a child component in that deferred thing. Okay. But we won't we won't worry about Yeah. Well, this was our child component, but it was this was just the JSX. So, you're saying I would just have to pass in a full component like render this somewhere else. Yeah. Separately. And then I would guess I would guess so. And I I I I'll have to look at that because I don't think I've used deferred within React. I've used it within spelt.
That was when I tested it out and and it worked fine. So, inertia does have spelt and view uh additions basically or like versions. I saw the view one when we set it up. Um so you can also use spelt. Okay, cool. Yeah. And there's not official starter kit, but there's other starter kits that you can use within spelt as well. Um but why don't we eight to 10 minutes? What do you What else do you feel like would be cool to go over? Let's do let's let's
go over forms because that's like the biggest biggest uh biggest thing within within Inertia is or within any kind of application is is going to be is going to be forms. And so inertia gives you a form helper. And we can probably see this if if we looked at the like a settings page or like even like the login page, we could probably see. So like even like if we go into settings appearance
um nope not that one chose wrong. Okay. Um let's do settings password. Um it's because it's passing it into a controller so we don't we don't have to click click through to inertia here maybe. Yeah. Use form. There we go. Perfect. So what's happening here is this is inertia's like form wrapper of
course like as you know forms are like everything within a application and so the way that we talk from front end to back end is not having to write any APIs it's just saying um I want to use a form um and then I want to send that data to a particular route. So you can see here we have that put route and then this is where we're using that named route
parameter. Mhm. Is password.update and then inertia form gives us some additional options. So like preserving scroll on success. This is what we want to do. We want to reset the form. If there's errors, this is what we want to do. So all this is given kind of like out of the box within like inertia form helper. Um mostly just to manage all this easily on the on the front end. Um, that's cool. So then this is going to correspond, this password update is
going to correspond to one of these routes over here. Y maybe. Yeah, right here. Okay. Exactly. So if we were to even click through to I don't uh if we were to click through into that password controller, I think PHP Intellofense maybe gives us maybe it doesn't uh password controller right here. Perfect. Yep. And so this is where that update. So we would be validating that information. So that that request
validate is saying um this is where we're we're kind of in in the while we're waiting for this to be to be validated on the client. Uh this Laravel gives us this validation rules out of the box and we can have even custom validation rules. But this is just as simple as saying um this password needs to be required needs to be uh you know confirmed with that current password. So
that way that confirm piece is a validation as well. Um and then and then any kind of like password so password defaults that it's passing in. I think that's like the eight minimum characters and you can't have I I I don't actually know. Yep. Just here. Password requires at least one uppercase and one lower case. Okay. So those are things that you can kind of like modify even just within these password
defaults. Okay, that's cool. Um, and then that request user is kind of like that what that thing I was saying like because we don't have to worry about sending oh I need to now send all this off information back to the client to make sure it's the correct user and like authorization piece. Inertia handles all of that for us. So we can just say if like let's update this request user that sync has already happened. We don't have to worry about any kind of security
concerns there. Hm. Yeah, it's nice to get a lot of that just built in to not have to roll all that yourself. That's kind of cool. Yeah. Now, like with Laravel in particular, you can Can you self-host Laravel? Yep. And there's like a Laravel I forget. I saw something on the site when we were looking at a second ago. Um like an actual hosted version too, right? Yep, there is. So Laravel has Laravel cloud. So we basically have like
three different hosting op options that are official Laravel. Of course, you can deploy wherever you want to. It's just it's just PHP and Node, I guess, if you're using Inertia, but Laravel has kind of like three official options. It's Laravel cloud, which is kind of like the managed for you hosting. Um, that's as kind of like a versell alternative where like if we were to push this up into GitHub, it would be as simple as saying I want this GitHub repo
and it will deploy it for us kind of thing. Just like CI build. Yeah. Yep. Exactly. um Laravel Forge, which is basically like you connect your own Hner server or Digital Ocean, whatever you you want, and it will set it all up for you. Um so obviously you're really only just paying for like the management of your server without having to do all the other stuff. And then there's also
Laravel Vapor, um which is uh basically like AWS for for hosting as well. Cool. Yeah, it's like crazy how many Yeah, there's just so many uh like custom names for things, you know, and like every area and I'm just like vapor cloud, all these things. And then Yeah. And then like inertia and I don't know, like all these different names. It's just uh cuz then if then if you look at
that like open source tab too on on laravel.com like that that's that's where it even like uh gets gets crazier because every package basically like has like a a neat name. So we have um you know reverb. Yeah. Yeah. And all the it's like all spec specific like most of the time if you need something there's probably going to be the package for it like like scout for example is like full text search so you can use things like mela search and um type sense and like
have all that built in. It's just it just abstracts away all that stuff. So you don't have to set it up much and or if like we were using we needed to use like Google login. There's um there's uh why am I bling on the name Sanctum? Not Sanctum. There's [Music] uh Socialite. I was like, why am I bling on the name? There's there's a lot of names. Yeah. Uh just these alone. Oh,
socialite. Yep. Social there. I was right there. It was right there the whole time. Right there just looking at us. Yeah. And then these are you have these two then you have spelt and then live wire is like the PHP front end and back end. Yep. So Livewire is the one that I kind of like like hooked into the first time I tried it. Um and this is where I'm kind of curious to get your thoughts like in the last couple minutes. Um is uh like so like the
reason why I chose Livewire and use it for most of my projects. Of course, I still like building in React and Vue and spelled and stuff like that is because um I have kind of like within Astro like and the reason why I like Astro is like I like writing, hey, here's all my client side code and then here's my server side code and I can just call it. So LiveWire basically gives you the ability you're writing if we were to do like that post stuff, it'd probably be a lot quicker because we wouldn't have to
jump around too much. Of course, like it's great with inertia in the long run. If you're building a huge application, you like you need to have that stuff. I like livewire like the speed of it because I could be like um within that post for example, we could create that form in the same file. We could create that we could even say oh I want all those posts in the same file without having to jump into a controller and render it and stuff like that.
[Music] Um, and so, uh, I guess like I could see that being like kind of the fundamental if you're going to like really try Laravel, like that should be where you start. It seems like, cuz to me, like when somebody comes into Astro and they're like, "Oh, but I also really want to use React." And they just basically port over their whole React app. I'm like, "I mean, you can do it, but it's not like you're kind of missing out a lot of the benefits." Interesting. Astro. Yeah. Um, not that I have a problem with using Astro or React in
Astro, but it's like if Astro is basically doing routing only and all your rendering is just done in React and it's like you're basically just building a React app and just like and you know embedding it in Astro and it's like I mean you get some benefits. You can use some of the stuff in Astro but it's like the speed like a lot of the superpowers of Astro I feel like are kind of at best handcuffed. Yeah. And that makes sense. But is that kind of Livewire? Like is
that a comparison? I would think so. It I it it's it's definitely fair. It's one of those things where I think within Laravel kind of like you said, you you it's easy to know that oh yeah, Laravel can just render and react like we're we're good. But it's harder to then see the benefits of Laravel. I think in a lot of ways where you have until you need them. You're like, "Oh, now I need to like have like I need to run cues." Well, that's all always been Laravel. to
just consume it differently within React. I think LiveWire, especially from at least from my understanding from the get-go, is a lot easier to kind of get this glimpse of um the the full the batteries included piece where you're like, "Oh, it's this simple." Uh if I'm calling something from LiveWire, I could do the exact same stuff within a controller and call it from my React inertia piece. But now I'm
just seeing it a little bit more quickly, a little bit more visually where I'm saying, "Oh, now I can send an email with resend and I'm just doing all that. I click one button and that happens." Of course, you can do that within Inertia. You click a button that's a use form, that hits a post, that hits a route, that does all that. it just seems more abstracted because it's it's meant to be that way, you know, like where you're like, "Oh, you can use React and your team doesn't have to change. You just have the benefit
without having to write this API layer and stuff like that." Yeah. Um, so yeah, I get that definitely with Astra, too, where it's like nothing nothing changes too much when you're using React. you just kind of like uh it's a it's you're you're you're not seeing the full um benefit at the get-go because you're just waiting for it when those times come kind of thing and you don't always know that they're there either because if you're used to writing in React then you're
you're kind of scoped mentally to what you know you can get in React and so yeah I always recommend people start with Astro like just do Astro only and then you can basically do extra stuff as you need to pull in a React app or you or React component or whatever. But yeah, I feel like if you start with what you know, in some senses it's kind of its own kryptonite. Like it helps you get started faster. You know, it's like somebody who's checking out Laravel is like, "Oh, I could use React. Okay, well, let me give it a shot then." But
if you stay there, it can kind of scope what you know about Laravel to just what you know what your expectations are with React. So, it's almost like, yeah, with Astro, I typically encourage people just like go all in, learn enough, and then if you want to jump back and start using a lot of React, that's great. I use React in a lot of apps um that I write in Astro, but probably do have to balance. But I really appreciate this. This is super cool. And I think there's a lot of like um patterns here that I'm like I want to kind of explore further now. Yeah. Um having just touched them a
little bit. I'm going to have to get used to that arrow syntax and stuff. But other than that, yeah, aeros syntax arrays where you have like you have the the single arrow. I I need to figure out now that I've done a couple of these where I'm like telling someone what to type. I I need to fat arrow, single arrow. a fat arrow. So there you there you go. See, I I need to learn how to how to do that a little better. It's always tough when I'm like I know what it is in my head, but like I can't say equals greater than, you know, think, you know, but yeah, thanks so much.
Thanks so much for having me. I really appreciate it. Yeah, thanks so much for jumping on be willing to do that. Yeah, I'm curious. Maybe maybe next time I'll have you try out uh Live Wire and we can do like some some resend email stuff. That'd be fun. Cool. Well, I look forward to it then. Thanks again. Sounds good. Have a good one. All right. Thanks you too. Bye. Awesome. It was great to have uh great
to have Chris on. Um I got jump as well. Uh got to get got to get working. Got to get started on some stuff. Um yeah, thanks so much to everyone for who was here who kind of like hung out around. Yeah, it was cool to see kind of Chris's mind go different places, especially when it comes to kind of like uh just jumping right into to things like the form functions uh and well as well as like what's happening like in in the back end when
it comes to database and migration stuff like that. Also, this kind of stuff always helps me when I'm telling someone new about it, especially an existing developer who knows things. Um, it's always great to see, okay, what pieces am I missing or what pieces should I make sure I focus on when we when we continue learning stuff like this. So, um, yeah, thanks so much everyone for for sticking around. Uh, resin, uh, want
to learn Laravel full free. What should I do? Um, there's a bunch of great tutorials. I would say Larcast has some free um, Laravel tutorials to to check out. I would check them out. Um, I have some full tutorials on my YouTube channel as well. That's youtube.com/josheri. Um, Dylan, have a great weekend as well. Thanks. Thanks so much for sticking around. Uh, thank you Learner as well for the stream. Diebell, then comes Vault and Nuno packages. I
know there's so much. I need to I'm making another video about uh some of the updates to my uh starter kit that I've done which include a whole bunch of like PHP type stuff that I I've learned quite a bit. Um, but yeah, thanks so much everyone for sticking around. I really appreciate it. It was a lot of fun. And thanks to Chris again for uh for being willing to jump on live and get that all all figured out. But uh but uh hopefully