YouTubestream· Oct 3, 2024· 2:07:41· 1,700 views on YouTube

Teaching a First-Time Laravel Artisan?

Watch on YouTube ↗
0:00

React at a moment you like. The best moments light up here.

transcript

287 moments
  1. it's been a while since I've gone live um on everything typically does this do that where it just like automatically yeah we are going to stream to Twitch uh YouTube and Twitter heck yeah let's do it there we go should be good let's see

  2. uh see what it all looks like I have the little are we able to so are we able to see like the is that what comment the comments tab is yes so comments tab we should see should see everything I should be able to like bring in people's comments as well um let me make sure everything else is sign in so let's see if that works

  3. try that again sweet sweet sweet everything is looking looking good I still stream yes I still stream ain't no way there a Josh stream yeah it's been like uh it's been like uh four weeks no three months since I've streamed it's been a little it's been a

  4. little bit um glad glad I uh back to into a corner then brought you on here yeah I I've always wanted to stream more like but it's it's one of those things where like you're either getting stuff done or you're streaming like it's it's tough to do both but my I tried to I tried to stream for the first time last week oh nice I

  5. don't remember what I was building I don't even I tried to do something um and let me tell you I felt like such a fool like I was on there and I was like yeah I'm G to do something that I'm familiar with doing so I don't look like you know a a doofus up here and like immediately I'm a doofus like immediately I don't know what's going on and people are like do this do this and I'm like you're like trying to keep up with the chat and trying to to still

  6. like get something done so I think like uh what I learned was you don't just jump onto to a stream without like a plan like it's okay to get sidetracked but if you don't have like an idea of what you're trying to do that day then you're definitely not getting anything done yeah that is that is true um can I intro will King how how about I'll let will King intro will King so will give

  7. give a little give a little intro for you before we uh before we get started so I am a design engineer at crunchy data uh they we do hosted post Chris but also I just like hanging out on Twitter and uh became buddies with Josh and the the lville community Through like a random uh a random series of events I ended up at Lille conference for like a single day and made a bunch of friends

  8. here in the lville community and got convinced I'm a big react like typescript developer uh and got convinced that I should jump in Lille and try out inertia if I'm a big react fan and I'd have a much more fun time on the back end if I didn't use JavaScript on it so um I finally found I finally found a project that I wanted to

  9. do Lille and said hey Josh could you help me and then we just decided why don't we just try to try to live stream me setting up my first laral project with inertia and see what all we can get done yeah do it do it live yeah yeah I think I think it's always it's it's uh one of the things I'm excited about is like for everyone who's ever watch a video of mine or like a stream kind of

  10. thing like I'm always excited to like learn new things and a lot of what I think will is gonna we're gonna like dive into is stuff I don't really know that much about like I mean I know I've built some things in inertia I've built some things with react and inertia before um but it's not my specialty like ever ever since I moved to Lille I've kind of been in the Live Wire world uh

  11. just because it makes more sense with my head uh but I never was a big type person I never did anything in typescript usually like there was an option between typescript and JavaScript I just chose JavaScript um so yeah I think uh it would be cool to cool to uh have this little project for you and maybe like I'll learn something too maybe you'll teach me about larab and I can just I don't know we'll have to see I feel like today this stream will probably be

  12. extremely laral heavy that is the hope uh just because there's I think a lot of setup that has to go I came with like data models and everything got ready to rock um and I've got all the fun ideas for the front end but front end is like one of the things where it's like you won't really get there until you got all your data data go well it depends you could you can go from the front to the back or the back to the front but today it feels like a waste if

  13. we don't start back to front yeah well we just start with like uh the the absolute Basics so uh why don't you you said you had a notion dock to like I do I do you want pull that up see if I can present yes all right share my screen all right yep yep yep all right we will start

  14. with entire screen or just the window let's do the entire screen just because we'll probably jump into code pretty soon after sweet down here all right so notion doc on air mark legit learning cotland to write a PHP storm plug-in for custom attribute detection see that's where it's like if

  15. you have a project I've always been this uh kind of like advocate of if you have a project in mind first it's always easier to learn something if you have something in mind like I I start the reason why I actually learned Lille was I had a long running um process that I needed and I had never like used like a long running nojz Q before so I was like oh I'll just learn

  16. larl um Josh I just found out that to share my screen I have to restart my browser so oh nice I'm H I'm a hop off and Hop Off be right back sweet no worries I'll chat with all all of you you lovely folks in the chat um oh Dev beard being a Windows user I was upset with the installing C that's sad I'm sorry tried it yesterday sadness and suit were you using like Lille herd or like uh because I know herd is is for

  17. Windows I I'm not I haven't been a Windows user in a while herd is kind of my go-to that just because it makes things easier um I know LaRon is a big thing within Windows uh which one were you using check both your mics volume please your seems to be a bit loud and our friend is too silent yeah once will hops back in let me adjust his mic is mine too loud or just right

  18. um yeah heard okay uh yeah I'm curious of what uh uh if there's if there's something that just didn't work like with the PHP setup or was more of just difficult to do both sound fine to you needs to be brought up a bit okay we'll bring up Windows uh I said window cuz I was like reading Windows we'll bring will up a

  19. bit when he comes back in oh he's back I'm back here we go he's back brought up as in like my volume yep I think I can all right try to bring it up how's that is that better maybe a little bit more all right how's that is that better for everybody yeah I think that's good cranking it there we

  20. go all right let's try to share my screen again we'll see if it works this time yes there we go let's do bring this to the stage bam all right boom all right so here is my notion doc so the project is called made by me this is not the file because I restarted so now we got to actually go to it all right product is

  21. called made by me and I have the the IDE aidea here is it's like a directory site plus like a membership not a membership like a newsletter and I'm going to gather content that is like ways that which people have like made personal software like software that doesn't feel Bland or like design that feels like it

  22. was built only for scale like ways that people can connect to software and it feels like it is made for them made for me uh and then like the the tie-in with the newsletter is that like you can get these pushed to you every week um versus having to like come visit the directory site okay and just kind of like that's the model um and so it felt like the perfect layal site because there's like this admin side of it which is there are

  23. these posts and uh the posts I need to be able to add uh like a a heading a description I've got it right here we got title description uh we'll have like multiple media files uh people will be able to like them there will be like people will be able to bookmark them at some point uh the source so this would be like the URL for like the business that did the did the design uh preview image and

  24. preview video uh these will be like editable in admin for me and then like longterm what could be fun is like uh allowing people to like put in their own submissions and also like potentially getting like Moder ators like there's this like long tale of like how this can grow which is why I wanted to build it into like a layap versus just like some super hard CED type thing where I just

  25. like manually add all this stuff so the the I sent you like a list and I wish I'd grabbed it and put it in here as well um let me do that super quick and grab it out of what I sent you I have this like list of like what I think the order of events could be for what we could get get done in a reasonable amount of time

  26. nice and we will find out if that's the case or not so this is what we're going to try to do we are going to try and set up Lille and inertia so whatever that looks like to just get like a brand new layerable inertia project going Y and then I thought it would be good to just get like the basic data

  27. model setup so like I figured that would be posts media we're not going to worry about like saving things with like bookmarks yet we're not going to worry about like submissions uh but we will need the idea of like users and roles because like only an admin should have access to the admin panel everyone else should either be like not a user and be able to see public Pages or like see public Pages as

  28. like a member or like a logged in person they still shouldn't be able to access an admin panel uh and then like try to get the crud set up for posts nice and let's see that feels like pretty reasonable and then like if we have some time because apparently lville is very productive uh get into like creating user accounts and like maybe then we

  29. could try to see if we can like have a way that like user accounts can save their own bookmarks so we'll see what we can I like it I like the plan I'm curious uh because you you you so first time doing a Laro project correct you haven't touched it before um no none I mean I've I've been perusing docs and looking around um I I watched

  30. the L cast a couple months ago you know so like I know conceptually what is possible um but I don't like the rubber has never met the road and that's like when you get like punched in the face is when you're like oh this is not that hard yeah so and like there go one thing I will say looking into loville um and why I specifically thought this would be interesting is like there are so many

  31. branching paths paths that you can take because Lille has like these packages it seems like that do a ton of stuff um and if the like what are the Right Packages to choose and that felt like a ton of research and a ton of like effort to try and get over the hill of like well I don't want to start with the wrong pre-built thing and then have to try to switch it later when I find things about it that I don't

  32. like um so I I just was I was curious if like going this route would help me find find out what what packages pre-built things that lville just gives you out of the box make the most sense yeah yeah that makes sense uh yeah let's let's uh let's get started I like that you have a a set up let's see uh in the comments so we have uh uh un rly Hof fixer yeah I love me

  33. some Lille that's good you're in the right place then um David nice concept coach there you go thanks David yeah we'll see if uh the see if the concept uh can can follow through I've got some some really fun ideas one of the fun things about building something that's like this idea of like personal software uh and like personalized design is that like the website then gets to have a fun a lot of fun little

  34. personalized design details so we're gonna have a good time exactly and user as well I like this guy yeah yes yeah I tried to scale it up so everyone can see and I just I just zoomed in on the the notion doc a little more for everyone hopefully thats good yeah let's get started I I think you already had installed Lille herd I do I have heard so I can open this up okay it's detecting a bunch of sites but not all

  35. of them are okay and do you have um do you have the projects directory yes I have a directory plugged in so perfect so sounds like I pressed this plus button yeah you could press the press button or we could do it all in the terminal if you want since you're just do that uh if you type larel new LEL space new and then we can create there

  36. we go oh name that feels pretty pretty yep and even if you admitted that it will prompt you for one too so uh this is kind of like the basics of like that first question of lville Breeze versus Lille Jetstream Breeze is basically both of these have react with the nura options Breeze is probably going to be where we start Jetstream is a little bit more opinion a little bit more Hands-On it's basically what you

  37. would call like a SAS starter if you wanted things like teams built in into that yeah so like and and uh jet stream does not include react I don't know why I said that uh jet stream is just view and Live Wire so gotcha definitely Breeze because we need react but also like I think I would just prefer Breeze anyway cuz oh yeah I don't want I don't I'm not if this isn't this isn't ass

  38. SASS and like by default I tend to want like just enough done for me without too much done for me and I start with Breeze like 99% of the time too okay so react with the would you like optional features definitely want oh wait what is there a way to go yeah yeah you have to press like space to like uh multi select them I don't know if you can go back we might

  39. have to cancel out and start it canceled there go again all right there probably is a command for back I just don't know it we're GNA do that one inertia and script I thought about dark mode but you probably don't want do you want SSR for that did you say SSR I could can't see actually yeah so I do want SSR because this like this is like a Content

  40. play so like it needs to this is not like a spa it's very much a okay I like it gallery of content so we want our content like there might be P like it would make sense for the admin not to be SSR yeah but like we definitely want that like those directory pages to be like server rendered for sure I like it and I think it's Ben it's a it's an nice

  41. a nicity of inertia is like has SSR kind of already set up and yes excited about inertia 2 coming out I watched like I'm so I'm a remix user by default which got it love it a lot of the things that inertia was coming out with in V2 uh were influenced by a lot of features that like remix kind of like brought to the surface that a lot of Frameworks have started picking up on and so I loved how it was looking and

  42. felt it felt like the right time to start getting getting into this uh I'm going to assume pest just from like observations everyone loves pest correct like pest is the the functional syntax version of PHP unit so PHP unit is more like class-based um so most people kind of like especially newer to PHP new delal kind of uh like GE are geared more towards so

  43. yeah is a good option what I like to initialize a g repository you know it let's do it oh all right this is the kind of content we need more of I agree especially knowing that I uh I'm going to rely on will for a lot of like uh stuff like types and even just how you would do I know enough of react react used to be the thing I I

  44. built in it's been about a year since I've a project and react I would say oh yeah you go you do what you need yes default database update would you like to run default no all right reason why is we're going to do something a little different we're going to do something a little different here okay there you go you know I work for crunchy data one of the things that we like to

  45. do for our databases and what I like to do on all my like other like projects with the database is have like a cloud staging database or a test like a Dev database the idea here is that like especially with teams like that's like my favorite things about it we'll just go ahead and get this going here as well um so I'm already logged into my crunchy data account over here so I'm just going to create like a new cluster

  46. real quick for like a posted one so this is going to be made for me and this this one's going to be Dev we're going to do AWS we're going to pick a Us East since it's our Dev it doesn't super matter what our region is but like the the beauty about this is like in the production database it doesn't matter where like our primary is like we can

  47. put out a bunch of read replicas for fast reads but we're going to do our like the bet it's like hobby instance so it's like super cheap to get started um with this and what's so great about the the hobby database like how we do pricing we only price based on usage um so like for a Dev database let's say like you're not really using it a ton sometimes you might be sometimes you might not be but like

  48. let's say your Dev database is like not getting used if your bill is under I think it's $5 I believe if it's under $5 you don't have to pay for it so it makes it really nice as a Dev database because it's like in the cloud if I'm on another device trying to work on like a local project like I don't have to remake all this data from scratch or have to like generate a bunch of new data and also like it's great for our team because like for our team like let's say I'm

  49. building a feature and like somebody else needs to test the feature out and everything like they're already on the same database they don't have to like get some sort of like migration data set up pulled over to their like local so it's like one of our one of our favorite things to do so I just went ahead and got that one going and I'm going to plug in I'll plug that in once it's we get to like the connector database start sweet

  50. now why don't we do that lville larvel app is made larvel app is made it's scaffolded for us we have cd into user named this migrations made by You Me I did made by me we'll solve it later made by me made for me I'm already get myself fused on my own there you go on my own thing all

  51. right awesome let's take a look we can get started with like the EnV set up our set up our uh database I don't know if I can go in the does this go into like the the route it is the route yes we should have one already scaffold and out for us do we have it oh you're right one sec inm's kind of weird sometimes where they hide the hide the hidden ones hide the

  52. ones yes so that's like cap will stream be saved yes it will so I I'll keep this recorded afterwards I might grab some things out as well so also just for everyone uh who was like Yay an inm user I've been an inm user for like all of like a week and a half now oh there you go maybe two weeks if we're we more than I have so things will be slow you'll look at me and be like what do you mean

  53. like why why did that take you so long the answer you uh were you a Vim key bindings user like in your previous code editor before or no no I wasn't like I'm just completely jumping in here there you go and there's a lot of noise going on in here from warnings but we'll see we'll just get we'll just keep going and we'll see how how this all goes maybe I can turn these

  54. off doesn't matter we accept you as one of us turkum says there you go all right well we'll just pardon all the noise we'll what do we got going on next yeah so the we could set it up to the the database if you want to do that and we can run run default migrations and create some models and run those migrations that might be a good good Next Step do you want me to hide the screen while you set that up I don't know yes actually that'd be great

  55. because I'll have to grab some stuff some you do that screen being hidden so while will does that I'll I'll look at the look at the comments uh how can make larel product live site in GitHub like so you can't really do it like in GitHub Pages or anything like that but you could take that and host it somewhere like larvo Forge for example or any any server that you have um yeah most like even like Lara Forge

  56. or any like place that your hosting is going to have uh the ability to do GitHub deploys too so seeing if I missed any previous comments all right we've got this will be our

  57. host then we've got the database name and our user all right this says usern name so let's make sure that mates

  58. password perfect oh you know it's so funny so um here I'm gonna hide this real quick let's see if this actually works there's actually an Arcane way is statically export L website then you can yeah that is that that's a good option trick there is there are some packages that do kind of like hey just let's statically export this and uh especially

  59. if you're using any kind of like flat files and no database that might be a good option too I have not done that yet within a LEL project but might as well you could the the sky is the limit for how you build things all right PA that would be fun Mark okay my in set up I'm going to go

  60. ahead and hide that one Perfect all right we' got the M hidden now so we should okay bring you back in why don't we try um we can we can try doing like a a migration just to see make sure everything's connected properly want to do that the database is still being created so okay why don't we we'll wait

  61. for that yes why don't we look at um the so I figured where we would want to get started would be by defining data models yep let's do that where where do where does that happen yeah so there there's a CLI which helps us kind of like generate those files and get them ready for us uh but it happens in app SL models is where the models are defined and the migrations are going to be defined in the database directory

  62. um so the best way to kind of like get started you uh in the notion doc what was the first Model we can kind of look at that yeah we can we can go through like the user to see as well what set up uh perfect yeah let's let's do uh let's do this this post and we'll kind of like walk through that so if we we go terminal we'll go uh command line perfect

  63. PHP so anything that we're doing within laravel is going to PHP Artisan then we're going to start with make colon model and then after this will be the singular version of the name so post with a capital P and then after that we can type T Dash M and if we wanted to so dhm means a migration so we're going to create a model include include the

  64. migration with it y if we wanted to like here is where we could also include like controllers as well if we wanted to scaffold those out and be ready for us um Can those be scaffolded like later based on like an existing model yep y it can be can be done later usually I like to start with this and then then go to it uh from there um for example the dasm you could like do a-h MC which would be

  65. a migration controller there's also resource controllers which kind of scaffold out the seven like uh index show delete store M mhm those different functions yeah uh and if you have so if you have like a does it detect if you have like an an inertia setup and do do you know if it like knows enough to like scaffold out inertia specific things or is it like General things that you then

  66. have to customize on top of yep the scaffolding doesn't really care about like where where you're displaying it so um the only difference within the difference between if we are doing like a blade which is the kind of like templating system for larvo if we're doing like a blade setup versus inertia the only difference is we're doing we're returning a different view so it's an inertia view versus a standard view so the actual methods of the controller

  67. usually don't change it's just how we're returning that data gotcha all right that makes sense to me well cool so we'll start here's yeah let's do it let's do it all right so I created two files post.php create post table kind of takes that singular and just kind of adds a little s to it um it's more complicated than that for people who real but

  68. um all right so we have a class that extends a model um I'm assuming there are some defaults on here which would be like it uh like automatically knows primary like it sets up some primary key on your model yep so if we go into the migration file that's this is where like uh like what what just to just for my own say like what what uh kind of how do how do you

  69. interact with a database within your within your experience like within JavaScript so in JavaScript it's very I mean it's very similar except like you're responsible for defining like everything so um I'm a big you can use Prisma or drizzle those are Ian there's a bunch of them but those generally are like the two ones that get used modern day yeah um drizzle is a little bit more

  70. of like a raw squl like it's its uh selling point is that like it's just like a very basic layer on top of SQL and feels very like it's type safe but it feels like you're writing squl stuff whereas Prisma tries to like hey let's make this as JavaScript e as possible and they've like they started there and now they're moving back Wards towards like allowing more SQL type stuff um but like the idea

  71. there is like you're it generates migrations for you but you're still defining like every single field in a schema like you define the ID you define all the fields you Define relations created at updated at like every field you want you have to explicitly say that you want that field yep yeah and I think the the difference then within like like a Prisma or a drizzle versus like what

  72. Lille does or I guess most like MV MVC like if rails or stuff like that is Lille is going to have like the migrations file for each specific thing so it's not like uh with imp Prisma and drizzle you just have like this schema file we like hey this is the source of Truth within larabel you have the model which is basically how does this model how does my code interact with the database where the where the migration is going to be what actually is created

  73. in the database right running running those on database themselves yeah that makes sense to me y exactly so we'll start with the migration it' be safe to assume it'd be safe to assume like we're going to by default have an ID and like time stamps is what it looked like and that's like the only thing you get when creat the only thing of like hey this is this is what you need for everything else so yeah we can start with just let's put all of this into our our

  74. migration then cool all right database is ready let's see I should have tested this beforehand no worri like I've never connected to like a postgres database and larable so we'll see how this connects all right so now we run migration we're going to go to terminal I would assume again uh yeah why don't we create the post or I guess we could we could run the migrations if we want to some Fields yeah we can add some

  75. fields for the Post cool uh so yeah in that migration um so we're not actually going to add them into the model it's going to be just Migra so like you interact directly with the migration yep exactly so that's the okay I like that that's the biggest key difference at least in my experience from like going from like pris the model does not need to know anything other than like when you're specifically wanting to like add functionality on top of your actual

  76. exactly you got it y like that interesting yeah so we can like after that ID let's go ahead and do we just do table uh so dollar sign table and then we can do um oh nice we have some you have some uh I'm assuming tech text would be like a text field and then I can just name it whatever name it for title yep exactly you got it

  77. cool and is everything a text field or do y'all like deal like do you generally deal with like different sized let's see like varar or any of those but it seems this I'm assuming it's be oh Char would be the other one yep Char text string that's that's when we need Aaron Francis in the chat uh yeah uh chat I I I don't know so like Chum is saying please use string and not

  78. text somebody said please use string yeah I I honestly don't know I know that there is a big difference I think text is a larger set so if we especially for title we probably would want text orp probably would want string description we probably are fine with with string uh text us for massive blobs okay I forget is it like 200 and yeah so I think description and text

  79. are pro or description and title are probably fine with strings I'm guessing unless you're are doing like a whole blog post within I was about to say I'm GNA go ahead and put it as text there you go because I would I would rather have the ability to decide to make it I can always make it uh shorter if I want to later but it's harder to just go bigger all right let's see we

  80. will title description let's go ahead and do what I'm going to do is I thought about I thought about this ahead of time so like if I'm actually setting this up I'm gonna I do know that I do want table and table is going to be a string for or source is going to be a a string because that's just like a URL um to like the company name okay uh to the

  81. company itself and I'll probably like pull that out later into its own table like company and be able to like create a relationship there at some point but we're not going to get started there we'll just make it a URL um and like same with like media and preview images and stuff like media will be its own table and we will just like create a relationship media would be like a has many media files and preview image

  82. preview video would be like uh like a one to one relationship between the two which we can figure out later but this should be good enough to like get started sweet yeah and the good thing is with migration so usually like within Prisma or drizzle for example if you change anything you just modify what you've already changed existed what it's already EX in the schema so like in

  83. instead of like changing a migration uh you change like this singular schema source and then you run them migration command and it creates a brand new migration got it based on CH the changes that need to happen which based on like the fact that it has like the up and the down here I would assume you do the same like once you've pushed this to production for the first time you're creating a new migration file to

  84. add columns to your table instead of like going back and and this this initial yeah and of course you can like like for example if I'm if I'm building out and developing of course you can modify and then just run a fresh migration with everything sometimes that's that's better but yeah you always have that source of Truth kind of thing um also everyone's letting us know that if you use string it is far Char so we can

  85. change like the length if we wanted to we could change length generally doesn't really matter unless you've just got some I'm not going to have any crazy database needs like scale wise to like need to to lower the VAR chart and it's not going to be worth it but that's good to know for sure there we go um yeah so if this is good for now we can go ahead and in this class this

  86. is basically where we're saying okay what can the user interact with the database now so there's going to be a protected function so if we go um if we go protected and then it's going to be uh no I'm like blanking as I'm I'm doing it as I'm in my head but protected uh

  87. you could go fillable okay oh I saw this so this is on the user one it's uh it's just like the little variable it's like a protected and this like this is like based on what I'm seeing here oh sorry yep yep don't autofill that I just I had didn't have

  88. your screen in front of me yeah so it's going to be an uh an array of specific options and so what what's basically here is like okay here's what the user can input when we interact with the so they can add a title they can add a description and you would just add like the field names like this yep exactly and this is like this is like

  89. telling inside the model this is giving us whether we would be able to um PHP we care about semicolons yes we need we need um definitely a change coming from JavaScript land uh so this is like basically saying like if there are fields that like do exist they may be like a calculated field or something you

  90. would maybe hide those fields from like being fillable on a for like this explicitly says like this is the only type of data we're ever going to accept from like a a client input yep yeah uh what p is saying is protect against Mass assignment so yeah any anytime that you're doing so there might be specific fields that you're you know adding to within private functions on the model uh

  91. but those you don't necessarily need to have fillable so all fillable is saying is um within any kind of of mass assignment for controllers or resources this is what is allowed to be edited gotcha that's cool yeah let's run the migration see what happens so in our terminal we could do do you still would I still call it

  92. terminal within within like so this would be this would be a terminal window the this view right here this is called like a buffer specifically it's like a buffer window um that makes sense it's weird Tabs are not tabs in neovim I learned that CU I was like looking at the shortcuts I was like close the tab close it it's like it's not a tab it's a window um so this is like a buffer and then this is like a technically it's a

  93. terminal buffer but like it's terminal okay that makes sense so we're gonna run PHP Artisan migrate okay and then that is it let's see if our our database is happy oh there we go and it just works that's cool all right I love that so now what we can do because we have

  94. herd installed we can run well in our in our uh terminal buffer we can run mpm runev which kind of just you know gets everything set up for on the client side okay yep we have our post table sick all right sorry what were you saying again uh we could run mpm run Dev just to get um just to get because uh the

  95. breeze in installs vit and Tailwind yep so we kind of have it available for us to have our project up and running oh might help if I actually there we go pleas like Dev not Dev R there we go okay now if we go to made by me. test in our browser we should see everything kind of

  96. a up and running there we go so why don't we like reg this is Breeze this what I'm seeing here is like the breeze default State and it get this specific this specific page is the larel specific State um but Breeze is login piece so Bri uh without doing any kind of scaffolding uh or any

  97. kind of a starter kit scaffolding you just have this page and nothing else set up Breeze includes yeah any kind of JavaScript for us as well as tailwind and authentication scaffolding so we can go ahead and register a new user and like what if you're creating a new post as a user in your application are they doing it authenticated

  98. yes they posts can only be created by a admin user or post can only by I'm an user okay yes and I was looking at let's see let's go to the notion do full of stuff um let's do it I found let's see see if I saved it here yep Lal permission by is it pronounced

  99. spotti spoty yep spoty all right SP so spoty see seemed to be like what I wanted because it does arbac um what up Jason uh seems to do like arbac uh roles Ro based access control so like that would allow me to specify like admin user moderator like roles and then within the roles like you

  100. can set permissions so like those permissions would be like admins can create a post update a post delete a post but like moderators might only be able to like create they might not be able to like edit or delete or like something like that um and that's kind of like the model that I want want to go with got it so yeah and you can definitely do all of that within like a package like that larvo also does have

  101. out of the box things like authorization let's start let's start with out of the box I like that I'm because I would because I would assume it would not be too hard I'd rather learn like stuff with without a package if there are things that are just included in the framework yep and then only jump to something more if I like run into like a a weird case where it's like man this is uh frustrating or complicated and I need some more like control yep so let's do this yep um yeah

  102. so let's why don't we register user just so we have someone in the in the database and then we can we can go from there so if we register new user we'll be kind of kicked over into the dashboard itself but yeah Lille out of the B out of the box for ha for authorization has things called Gates and then policies and so those are kind of like two things so in our user table what we could do is add like a is admin

  103. function or even in our user model we could have I've done this myself of saying like hey is admin and then it's equal to your email the one that you sign up with um and that's kind of like the the bootstrapped way of doing something like this heck yeah all right bootstrapped way would so what kind of let's let's do boot strap first and if I want to like start adding like the real deal later we we can do that but this will this will help us get started out the right way so we want I would assume

  104. it would be all right what's the difference so coming from JavaScript it's very functional it is not class-based what is like private protected and public I think are the three different ways to Define stuff inside of a class yeah you're you're asking the the the guy who came from JavaScript on some details you've been you've been in here long enough you should know these right uh the chat you can help us out yeah

  105. yeah help me out chat because I'm I'm GNA F the the public property so if you're doing like a public function is something that can be accessed from anywhere anywhere so within assume that's what we'd want yeah that's we want to be able to call this from anywhere and the pro protected property is can only be accessed within that class itself um and so for like an is admin we probably want that to be a public function

  106. sometimes this is like super Ally would roast me for this if she was watching this right now but my instead of doing is admin since my last name's King I always like to say like instead of like super admin or whatever I just say like is King because then it's like it's just it's just me there you go all right so is King all right question so how do I so if I want function versus public function this game

  107. yep all right perfect if I want to reference the current user because I'm assuming what I'd want is something that looks similar to and this is might be very wrong but let's pretend that this is what we want is there okay so in JavaScript we've got like double equal and triple equal

  108. and you always use triple equal is there like anything conceptually like that in PHP where like you have to be concerned about how many like what your comparison operator is yeah um the uh it would be the so usually within something like this what what we could do is we just want this to return uh uh true or is is not true so you

  109. could even just within instead of uh this user email you could just do uh return this email because we're already on the user and so we could do return this email um and then yep yep and then send meons again it's GNA get me every time there you go private is only

  110. available inside the class protect is available in anything that extends from that class okay interesting public from everywhere Jesse I think you know neoven by the way comparison operators are identical to JavaScript triple equals make sure it is identical both in content and type cool okay there we go I like that see this is actually the real reason why I stream so that people we bothar the so I don't uh

  111. have to just pull up chat gbt all the time um is not in camel case format I'm assuming that matters if like I have a sty like I I installed like a Style style guide okay um like PHP what is it called I think it like it gets included in this where it's CS fixer is that what it

  112. is yeah where it's like there are like some rules about like things you should care about so is this saying like that's probably yeah that's probably one of the rul Cel case and then like obviously it's like hey we like comments cool we'll ignore things like that cuz we're just streaming common is probably referencing like PHP Doc is kind of like JS Doc in a lot of ways where you're saying you have

  113. I don't know the exact difference between the return type type and the PHP doc I think the PHP doc tells what the actual I think it's double I don't know actually the case of that who knows the difference in in chat between uh what imagine docs are just like the docs are just like it's there because you they want you to put it there y yep and I think

  114. most people use um most people use camel case for the for the function as well so I think that makes sense um uh you I think your mic went to something else all right am I back can you hear me now you are I think it it might be like your your airpods they got oh switched

  115. it did see you I got crazy hands I can't there we go better is that back on my good mic yep you we are back cool all righty I just my wife says uh she's a kindergarten teacher so she's like early childhood development she's like will uh you got missed out on being diagnosed as ADHD when you were little like you definitely have it so like I just I that's like I notice that when I do

  116. podcasts or when I'm streaming or doing something like I'll always want to like touch my mic or pull it closer or do something with it and then it just messes it up so I got to get better at at not doing that kind of stuff all right so we've got our user that is Kings going to matter later but this is this should just work out of the box like if I come over here yep to our registration page and I say my name's will King I make sure that I get the

  117. right this I'm not going to tell you what this password is oo here's an interesting thing will there be rules that tell me like my password's not strong enough yes okay interesting so I will try that

  118. again boom all right logged in BO there's a dashboard there we go and so you're you're only wanting admins to access this dashboard is that would that be correct that is correct so let's here's a fun thing that we can do we could do um after we'll just add like two to this so we know that this will

  119. fail and then somewhere in this app is a place where I can like add something that says if is King and they try to access this route redirect them to index instead or homepage or something yep yeah and might have to pull up where that is in Breeze specifically but I would imagine it would be in

  120. our um in our app uh HTTP is where the controller is going to be for actually like login and we can go into our middleware and this is where we can um okay middleware that makes sense because we can we could probably do in like two two places we could do like we don't even want them to sign up or register and we can also do it in our middleware because there we have we have an off middleware

  121. out of the box um okay like this one and this is going to be Shar this is going to be a different middleware for handle inertia Quest the actual we might not publish the off middleware now that I think about it so when I say publish one that means like when we ever scaffold out there's

  122. things that can be like in node modules for example that are just specific for a for a library um I don't know if we publish it I think we do let me see yeah we could do like a a login request or or like a um because you would probably want this in in your in your registered controller you don't want to register unless the email is

  123. specific oh interesting or you're saying like I shouldn't even allow like okay theoretically like starting out I do want anyone to be able to register because registering like they will register and they will be assigned as a member and get added to like the newsletter so like I want people to become members by the end of this because I want them to be able to like things I want them to be able to like save things that they like to like a bookmark

  124. and like for them to review themselves later in their account but that those will be like separate pages from like this concept of like the admin Pages got it okay no so I see what you're doing okay so let's do let's do this it would be like a middle it would be a middle Weare because it' be like anything the way I think about it would be like anything that falls under this route group inside of this like o group Weed not an O group admin group I would want

  125. to define a set of routes that were like admin and say must be king to visit these yep yep yeah let's let's do this let's create a new page in our dashboard so up on the top we can like add a new nap that would just be like we can like call it the admin Na and that way we can work put in a gate that says um like only this admin is King user can

  126. add access that um so if we go to resources that's where going to be our front end files are are kind of built out for us the JS so it's not going to be views it's a little bit it's not little it's gonna be in the JS folder because it is Javascript that is fair that is fair um and then pages and we probably would want to put this in the components because there's a there's a nav bar already set up for our components that

  127. we can kind of add a new page to go to um and so the nav link actually might be uh yeah navlink I believe is what it is let's see all right this looks like component that we pass children to it's probably in the layouts I think about it's probably or it might be it might be in pages off too it's been a while since

  128. I've done I've scaffolded out of n authenticated layout here looks like we got nav link here which makes sense and it's got a link to dashboard dashboard is like a fine Place let's so what we're saying here is we want to add like another let's just like add one of these and we're going to call this route

  129. name uh admin route current yep so that is just saying uh there's an active prop that gets passing yep it has that little underline afterwards got it okay and then perfect I think there's another place like for for responsive if you want to but yeah let's call this this

  130. way this feels nice we'll just go straight to post that way we can like hide or show like the posts I would say with there with for slash so that it's actually going to be um a named parameter so I would say admin. posts for example so this that would be the convention yeah yeah say this is the post it's not like URL even though it's HF it's like it's like a

  131. special parameter to these specific functions you've got it y got it okay cool and then that means what we want to do is what would we would add a new page uh yeah we could we could do add a new page so we could duplicate that dashboard page is probably the easi and just like modify it from there um and

  132. then what we'll need to set up is an actual route for us so this isn't nura is not page based routing in the sense that setting creat cre a new page does not automatically say okay now SL poost is um mhm is it we'll have to do it within our web routes file I'm sure there's some way to duplicate but we're not going to worry

  133. about it we just gonna create posts TSX and then we'll go in here and we'll just highlight everything thanks eore route middleware yep I think that's

  134. going to be the option Chum yeah so I think what we could show is Route middleware and then maybe even do a gate uh so that you only see that link if you are an admin we'll just start here cool Perfect all right we got a new page let's go to our

  135. uh it's going to be the web.php okay is where the uh the routes are going to be web.php is that what you said yep okay oh okay perfect yeah so this is where all the all the routes are um and you can you can see here that uh

  136. something like that slash um it's returning this inertia render and so that's basically saying okay when we access this we're just wanting to return this page and that middleware is an array that we can pass in and so what we can create is a new middleware that's an admin so that way we can uh pass it to this so what we can do is um we'll we'll kind of and we can add this

  137. uh would it be something like like it would it kind of match the off in that like now we would change this to admin yep and I I would say uh we probably also want it uh admin and off so we could um and so with within that I see what you're saying so like this would

  138. be we would put this in side of here as like a sub is that how it would work is that how it works um what you could do is do uh you could you could do the sub too uh you could also do like a completely separate it kind of comes down to personal preference there's probably people who have strong stronger preferences than I do all right chat do you'all have any

  139. strong preferences yeah let's see what is what is the strong preference that I should care about you so what's the separate way how do you define multiple would you put it in in Array inside of middleware okay you would take it out put it into array yeah we're g we're going to do that I decided my own personal preference yeah and it would be an array of both admin and oth okay does the order matter so like based

  140. on the array order run the off middleware first then admin after that the order probably does matter I actually don't know that's a good question cool I would assume it does because like there's my guess would be like admin oh you muted

  141. yourself I me I think I can again oh yeah your your mic died again or or reset again yep all right I'm back I got to quit touch my mic man let me tell you this going to be like the running joke Allie's going to watch this back and that's what she's going to r on is that I just can't stop touching the mic Ally just uh replied to like the the live stream tweet and she goes is this

  142. why you aren answering my te texts about packing the kids soccer tonight I'm on this stream to which I will be replying yes sorry didn't see the text messages see roasting you live on stream as another check oh man it's she's hilarious all right so awesome so I I I think order matters because yeah admin is going to assume there we go you're gonna assume that like off guarantees you have a user that way like you're not

  143. then having to like potentially have like a a not user object when checking that function cool yeah and I think it like you can Define we can also Define like in our middleware group of like which ones of those steps runs first too like if we had like a whole big group like within o there's a bunch of different middleware that could happen too yeah um yeah so here's where we can we can put one route git and we can call that

  144. um we could call that posts or like whatever you want to whatever you want to call that for okay question yep if we are doing so in this case there's off the middle Wares don't do anything to define the route correct so like if I change this to posts like it's going to be made what

  145. is it made made by me. test/ posts so like if I wanted it to be admin SL posts I would need to add admin here because yep yes that's what you're saying yeah the the admin middleware does not do anything for the actual uh H hre location uh you muted again

  146. let's see I cannot hear you yeah you're I think your your mic either like shut off or or died I can't hear you at

  147. all good evening Kristoff good to see you order matters thank you tto yeah it's late for you Kristoff I was gonna say it's a it's it's after afternoon in my time which means it's uh it's late for you

  148. still no on the mic at least on my side I don't know if I've maybe I maybe I lost audio let's see I don't think I did though I saw that you were live with the

  149. basketball coach I was what I was wondering what is going on here so cool yeah this is Will's first time uh writing Lille and he is throwing me in the deep end with uh with inertia still hear your soldier voice thank you thank you I practiced that every day infinite scroll inertia too inertia

  150. V2 coming out soon I know Taylor posted yesterday I think like hopefully by the end of next week that'll be that'll be awesome I thought it would be in Fr yeah I uh that' be that'd be awesome uh I I am trying to get Aaron he's he's uh he's he's still recovering I think but I'm trying to get him on the uh on the uh on on a stream soon maybe not maybe

  151. not stream but I'm trying to do a recording recording with him we'll probably stream it he he'll probably stream it uh but we'll we'll see we'll see when that happens he's a busy guy he's a busy guy uh I think will is trying to uh fix everything so he'll be back

  152. on so we we'll we'll turn this into like a little Q&A I'll answer any questions oh will is back here we go sorry I don't know what is going on I guess I'm gonna have to get a new mic oh no that sucks it's just so touchy nobody likes a touchy mic all right so anyway I was saying something that is not important so we can just move on from that oh no

  153. worries admin SLB perfect and then at the very end where we append the name there that's when we're that's what's going to be kind of like and this is this is that like uh what got passed into that uh link like that function on the like the nav link exactly so this would be post do uh I think we call it

  154. admin. poost admin. poost right jken I've got to say if this is Will's first time using L he's got to be a very clever person asking all the right questions and great Insight yes first time first time in Lille thankfully not my first time ever doing backck in so I've got at least some little bit of a leg up I used to do a lot of like a Elixir Phoenix oh okay I didn't know that I'm a big I'm a big functional guy

  155. but I don't know something about lville I think it's the people I just wanted I just wanted to come over here and hang out this is where I want to hang out so did you do like it means I got to learn Lille and PHP that's fine with me did you did you like Phoenix live view type stuff or was it I did so I like when it I was using that when it first came out I built like this um so you know like you're you're a a a man who loves Jesus um I was building this app that I called

  156. uh without ceasing where I was like nice it had like the the ESV version and you could highlight passages and add like comments to them and like the idea was like you could like have friends and you could all see what like you're highlighting and commenting on passages throughout the Bible together yeah and I was using live view for that and like I built I use like the tipt editor and like did all this stuff to make tipt

  157. editor work with live view back when it first came out and I'm it was just it was a lot of fun but then oh I just didn't you know like when you don't use something for like an actual like work project you it just kind of Falls by the wayside and that's what happened with Elixir and Phoenix I got super to to react cuz I was using it for like actual work projects so I just wanted to get deeper and deeper into

  158. that there you go that's cool though I know that live view is heavily an inspiration that came Livewire in a lot of ways yes I know that it was kind of around the same time but yeah they kind of like it's they they it's like they take Concepts from each other but they're still like fundamentally a little different yeah maybe fundamentally the same but like in

  159. practice different there we go yep yep tailored for their package for their yeah their ecosystem yep yeah my poor eyes I was wondering if when I was going to hear that comment actually and then like your your uh your system settings is dark mode because then we have dark mode for the uh for the app yes we actually did I never even thought about that I'm a man I'm a man of

  160. uh mult multi- taste there we go there we go uh and then we can either create a controller or pass this in uh directly so we can we can do one of one of two things um why don't we create a controller let do that looks like it's got as I say it looks like it's got a controller but I'm assuming we want to change this yeah because we probably change this to like post controller or something yeah I would say that'

  161. probably be like the best like a post controller and you generally name these things singular it wouldn't be like posts controller cool y that is the preferred preference and so we can uh in our command line we can type PHP Artisan controller we haven't I was about to go like try and make it in the yep get to

  162. do we do well I was I say we don't need to all right PHR is in make colon controller and the good thing is if you don't type anything after that we we press enter it will give us some prompts for us o okay and then we would say post controller Y which type of controller would you like and we probably be a resource y resource proba

  163. feels like it's a resource yeah now I'm curious what all these other ones are but we'll get there we don't need to get into it right now all right what model should this resource controller be for that would be the post model oh I just start typing okay cool post boom perfect so now we're going to have a post controller in here somewhere and we

  164. probably have to import that into the uh into the uh web routes it's probably why it's also kind of banging banging on us a little bit cool perfect okay this is where it is and then we've got to import it oh you're so in that other all right change to our other buffer and let's see if we can do this let's see if it's got the extensions

  165. code add missing import did that work not all right look we'll just go up here and add it y use app I've got my like I this is this is day one with PHP laral so my neovim setup is probably not the most ideal for it um but if we start writing a bunch of JavaScript react then there go things

  166. that are a lot nicer not yelling at us as much have a good one turking yeah thanks for coming in and commenting you had you had a lot following com helps yeah well don't follow Too Close wait till I get this all figured out a little bit first awesome and then in the what we can do is we can pull up the profile controller and kind of do like a a look at what that is doing so that we can kind of model it after the post

  167. controller or the post controller after the profile controller God okay so specifically we're wanting a oh there's a edit update destroy I'm assuming the first thing we'd want is a create yep and first thing we were B is probably like the index too so that way

  168. we're we're getting the view of the of all of the posts okay so here's here's where think oh wait no that's right because I would want to have like act ual index of these which profile doesn't have an index I guess this would also be different because if you if you have a post you probably have an index for users to see all all posts as well there's like this like idea of like the public the public list and then there's

  169. like the the like I think index makes sense well I guess this is where we can figure this this out okay so index and show I would think for this would be like specifically related to admin posts and then what I think we could do is create like a feed controller later there you go and like the feed controller can be

  170. like how we manage and deal with like pulling posts and filtering posts and what we want to do for like the public feed quote unquote I like that um that way it can still have its own concept of like an index and a show and they would be very different from like the post controller index and show and we would have all the other the other stuff like create

  171. and such yeah I like that idea yeah so in our in our index what we can do is we can uh return um an inertia View and so this will be similar to like what is in our web route already so we can return inertia yep then it's going to be colon colon

  172. view okay and then redirects redirects um sorry not um yeah that that's yeah that that that's GNA be different reg old view okay gotcha yeah and our web routes um the web.php one let's take a look at that okay let's get nurer render might be a nura

  173. render inertia render inertia render there we go yes so it's going to be in okay so because we're because okay so that's what this so what you were saying was like you can have a controller or you could just call it straight up this is like the idea of calling it straight up without needing a controller yep and then basically what we're doing instead is like we're pulling this this part out and putting it inside of our controller inside of

  174. our controller itself it would be it would be um instead of you it'd be render and then we would call it I think we just called it post so this would be like the actual name of the file that we created I'm just going to close this buffer that way I can see this

  175. things are so zoomed in Okay cool so do you have to so what you what do you put in here you you put in like the this would be the name of the file that we created and so that would be posts like capital P oh okay so this is directly this is basically just this is saying like render render the file the page yep got

  176. it okay and it always is going to be a page yep it will always be a page the second parameter of that render can be anything we want to pass to that page ah so like when we pull all of our data what gets passed in is like initial props into like the the page component you've got it cool yeah that makes sense to me and then so now here what we would want to be able to do is say

  177. um and then we'd want we'd want some way to like pull all of our posts yep you've got it how how does one pull all of their posts from the database yeah you could do capital P for post and so this is going to be like the OM of Lille which is eloquent so you have post um and yeah I wonder if does that bring that in that import okay we're already using that models post so we're we should good there and then it'll be colon

  178. colon this is where we can use kind of any queries for it and we could just say all okay for for example and that's going to bring in everything cool is there a way to does all have like any concept of like limiting in pagination yep so you do have uh the ability to paginate and so uh

  179. within um that would be uh just post paginate so basically gotcha okay so like this it would be here yep and you could pass in a specific number that you would want to pass for okay cool we can start with all though all right so all and this will just give me

  180. everything yep that would just give you everything if I wanted to filter What fields came back so like obviously I don't want to return everything because like I don't want all of the media files in the future like I just want to selectively I want to select um just like title description or something maybe to start out with and ID yep how would I and so yeah you you

  181. can kind of uh use the you can either use the select method and say I want to select these specific fields and get them you could also pass it into an array of all too saying in post all I want an array of specific columns so like ID do that title um so in that all parameter so in those mm mhm you can just create a new ID yep and that would be the columns

  182. ID title description perfect okay okay okay okay and then you could cool just make sure you have a semicolon there semicolon at the end classic yeah one cool thing about um one cool thing within larl that's also like neat forth passing things because inertia is you're you're just passing things to that view file one thing is uh

  183. specific like API resource which is basically saying okay anytime I grab all the posts I'm only ever going to want the ID title and description usually with an eloquin so you could tell it once this is what I want kind of thing yes okay yeah that's that's what uh I looked at like with the the spoty larval data package mhm that was

  184. like what I was looking into where it's like okay I can decide like what are the different data types that get past to and from typescript and that like automatically sets those up for me which I'll do at a different I'll like you know those are all the nics to have later on but yeah that that's probably what I would want to do here because there's going to be this like concept of like a there would be like a post

  185. detail a post and then just like a a post summary or something like that and then like a feed feed summary and a feed detail those kind of things yeah cool I like it yeah and so then after the the second parameter of inertia render is where we can pass in that post array gotcha so what we would do is uh it kind of takes an array for that so it would be a comma after posts and then an array

  186. so the brackets um and is this an associative array yes so like yeah it would be uh post yep you got it there you go I know some PHP because I used to I used to do WordPress that was like the first seven years of my career was a bunch of okay WordPress stuff which I'm so glad to be out of especially with what's been going on but

  187. but uh probably like why I avoided laral for so long was just like all the PTSD from no I never even did a PHP before I touched l i mean I had modified WordPress you have like no prec preconceived notions of like what PHP could make you feel like yeah I didn't write PHP I I modified PHP because I had like specific themes that I was building or like modifying so I was like okay I take this and do that but like I I don't

  188. really count that as writing PHP I just yeah yeah move some things around copy paste that kind of stuff uh yeah so why don't we try in accessing that post we should have everything I believe to to access it I think so I think so so we want to go to dashboard I'm wondering if it will throw it because we don't have a middleware internal server error okay yeah target class admin does not

  189. exist yeah we don't have the middleware actually created yet oh yes okay yeah let's make a middleware is is there like a generator for that or do you have to like right there is ah you go all right PHP this is so nice is it make and then make colon middleware middleware yep and we can if I just hit this it'll like okay prompt us for it so this would be I saw that okay so

  190. inure is there like some naming convention that you should I don't even know what you would do it for admin I think you would just call it admin I could be could be off on that we find out or inure admin who knows who knows I don't figure it out later a lot of people figure figure out that I I just because I'm new to larel like I I write larel like a a JavaScript developer JavaScript person yeah and then like yeah okay that makes sense then I'm glad I asked you because then you get me we

  191. can get each other oh yeah usually I'm like I'm just going to write it the way I want and then if I need to change it I can change it later I wonder if oh that's the rename that's really not that hard okay cool and so inside of here we would want to do let's close it up so we can actually see what we're doing we'd have the handle so inside the handle I would assume this is where we would be like we can do our check is this we'd have to

  192. instantiate so usually I would I would assume probably the best thing is in with before that return so it basically saying returning the next request I would say we could do like an if and because we're already doing off middleware we don't have to do an off check usually you would probably do that within you could say I want to make sure they're authenticate to right right um but since we're authenticating in the Middle where group itself we could do if and then we could just go off so this is

  193. going to be a capital A for a helper um and then it's going to be colon colon user and then that'll be like a function uh so like parentheses meth okay this is where we can pass that method the the is king oh okay and actually it will be like an additional parameter not not

  194. parameter additional like function so it' be like an arrow okay that's what I thought I was like I've never seen that before so like off it's okay so colon colon is like it's a static yep you got it facade is what Laro calls it yep okay facad okay I need to like I need to ask chat gbt what all those things mean because I was like looking through it that's like that's like the thing I think that is going to be the toughest not the toughest but like the biggest

  195. learning curve for all this is like I understand like all the concepts you know like I understand a backend I understand like getting data from your database uh doing things that you need to in the controller to send them to your front end like all that stuff makes sense I think what's going to get me is all of the like PHP isms of like yeah thing like class-based anything because I'm very functional like I said so it's

  196. like I don't know anything about classes or like things being protected or static or private even though they have classes in javascrip script M you know you don't really use them some sometimes you do but you don't really so that's what I I'm still I I'm trying to learn better too because like you know now a lot of people are coming out to me like hey like what does this mean like do you do this I'm like I don't really know usually the way I learn is I um I'm like

  197. okay I saw this done this way I don't exactly know the name for it or like okay you know this is what it's called in PHP uh I just know how to do it um and then makesense outside of the if was where we can uh return return redirect we could do return uh larel has some helper functions for us so we can return abort that probably be the best

  198. way to do it would it be capital A abort or lower uh lower case a so this will be a global helper so it's not one that we have to actually import okay aort and yeah so it looks like somewhere to go uh yep so the first parameter so it looks like in that help is what is showing us first parameter is a code we can say like 43 like unauthorized I actually don't think you have to put in that code parameter I think that was a type oh

  199. helper yeah you're right you're right it was still getting used to any of them all right four three message the message yeah it's nice that you have those helpers I don't even think I have those am I actually I think I I had minimize them for recording and yeah that's lesson learned I got to I before I do something like this again I need to look up all this stuff to get everything set up the

  200. way like have just the right amount of Errors like errors are still good but like only show things that are not whatever all this other junk is that's in here an and I think we need to import the oth helper so that's the um um now I'm going to have to look up the full name space okay it's use

  201. Perfect all right off not found let's see I just there's got to be I'm going to just double check this one more time we want to add missing import it's not going to want to do that we tried that already and it didn't know how to do that let's go after let's do this and see what we got all right is it aluminum there we go yep boom there we go there you go there

  202. we go there's guy some shortcut for that all right is King does not exist on user sometimes PHP actor doesn't no gotcha yeah at least like I I use PHP in telence and sometimes some of those methods I don't know if we have to like PHP like if we have to PHP dock them or something like that sometimes it just doesn't maybe that's uh but let's trying the post again because this should best way is to

  203. get it set up uh that is correct because all right all right so now this is created yeah is there is there anything specific so okay let's go back to um the web that's not what I wanted this one all

  204. right how does it know what this is called yeah so with there's no like like what's the connection between the that's passed into this array and like the middleware that I just made yeah within that I'm trying to I'm trying to think um I think we have to tell it

  205. um yeah the first thing we have to we would have to do in um the uh curent PHP I believe is what it's called okay so this is where we register middleware Colonel H it's not it's not this is lar 11 so let

  206. me I always forget like the exact name of where it is now um uh bootstrap app.php bootstrap app.php all right let's close that and we'll go boot bootstrap app.php

  207. the uh bootstrap SL app.php that one at the bottom there oh okay you had it I just didn't see it okay let's just go here where is it inside of uh the bootstrap directory so underneath app at the top yep yep yep

  208. yep and that's not what we want there we go and with middleware perfect see add links application figure web commands health and then uh in the with middleware function what we can call is um so instead of middleware pend

  209. because that that's just saying for any web request or appending a new middleware we're going to afterwards so after that middleware web one we're going to create a um middleware Arrow areas Alias perfect and this is going to be pass in an array and it's going to be uh first the name so this is where we pass in that

  210. name of admin and then it's gonna be an arrow function or Arrow I should say not function that's completely different JavaScript um and then this is where we pass in the actual yep we can pass in the full path or the import but yeah app SL HTTP

  211. middleware now was is there a shorter way to do that or is this the short the short way yeah if you import it at the top we can oh then you could just say admin or something you can be like admin colon colon class for example oh let's do that because we'd still need to do colon colon class after this yep yeah got it I'll do that later cool okay perfect and then uh after that after

  212. that should be a comma after class yes classic oh wait after this yep why is that actually don't know if you I need to because it's one array yeah internal server error turn be of type Boolean returned so it worked because it does not match but what we want is like a redirect instead of like

  213. an error it's because of it's not a Boolean so like if put return Falls okay let's go to we want user because that's where it's at return how do we make it okay so in JavaScript this would just return a

  214. Boolean yeah that is true now I'm thinking about why why is it not doing that is it because we used aort no it's a type error use King return value must be of type at models Boolean false is return false is a Boolean don't tell me that no body data

  215. interesting yeah because you have three yeah why does it not let's see if we I said false return though right let's see if that equals that then that equals that let's just very explicitly say that oh it's not that thank you Heaven it is a boou not Boolean for the return

  216. type okay there it is my types script is is showing and uh my lack of uh my lack of types is showing right like you don't normally you would have just left like the the return type off of that yeah I I sometimes do return types most you are not the king there we go cool okay so then that's okay so that's still like an error we can get into this later maybe

  217. it's something else maybe y'all can send me a link for this but let's say um for the sake of later on this is not important now but I want to like if somebody tries to go there we want to like capture capture that error and be able to like put it in like a flash message but still redirect them to like a different page that's like the experience I would probably want there is like they try to go to some route I redirect him to the

  218. homepage and be like that's not allowed friend yep yeah okay we're good y Lille has like sessions already built in so what you what we could do in like our our middleware is saying okay um return with a session message you're not the king kind of thing right and then in react in in nura what we could is just check if there is a session on anytime anyone loads the dashboard if there's a

  219. session show that flash that session M message gotcha okay that makes sense to me hey Michael good to see you um yeah why don't we do let's see do we want to uh we could either create like fake data and start displaying that in our react or we could have the crud function of actually creating the post Let's do let's do cred function I think

  220. that would be interesting um because the displaying stuff might be interesting but it would take a while to get there I think yep um because I'd have to like populate a bunch of data first so that'd be more interesting if I populate that data later well LEL does have a does have um factories where we could seed all that information we could fake it all too all right I think I still want to do crud stuff but I'm gonna keep that in mind because I want to do that that at

  221. some point too all right post controller all right here's where there I was like there's some issue going on cuz it was redirecting me and it's because we want this to be the index not the edit Y and now it will work cool okay posts you are logged in um we also want to go back to pages and go go to posts oh that's not what I want all right we want to go

  222. to posts and okay so now we're here we want this to be uh we're gonna change this to post posts we'll just call it posts and then um I want this to be all right so we're going to get past something um as a prop you're going to

  223. tell me how you're going to tell me how to find these props yep uh to get like the page level props that we want want yeah but if posts link exists then like here we're going to say we're going to add it in a minute we'll we'll show all of those at some point but for right now what we want to do

  224. is we're going to change this this is now going to be not a nav link I would assume it would just be like a regular link I think there's a link component yep yep and H maybe and then we'd probably want to be doing the same thing which is like I

  225. don't remember what it is but it's like route something y That's zout this would be the name thatout create and this would be like create

  226. post and then delete that one and now where do all right how do we access our like page level props that get passed in yep so if we import if we push them as props to that posts function it should just be available as like a regular it will be available for us yep thing would be cool now how to type those I can't

  227. tell you that but um that's what the dto would be for so we're just going to um we're not going to have any nice types for these yet so we'll have to make it ourselves but it'll be index ID string uh title string and description string now description is misspelled

  228. just so you know thank you and that's exactly correct because this would this would be posts

  229. array there we go all so and then like in the future like I will be adding the layal data which will give us like a type that we can import that got autogenerated that would just be like post summary array kind of thing um that just has one place right right exactly uh like it so it generates like in the root of your project it will generate

  230. like a generated types file that you can then import from so that will make that that'll make that nice all right so now if we save this um because we don't have these it should just wonder if it's because the route doesn't exist it's probably it like I

  231. bet I bet there's a I bet there's a console error yep not in the route list cool okay easy peasy so we'd go back here and we'd want to go to a get it would be a get again yep get SL admin SL postcreate probably y I'm not great at cruddy by Design like

  232. the uh the whole yeah it' probably be like new or something but once again who really cares what it's called if people care they can tell it Us in the chat and then we can care for them I would just have like the create post on the post page yes I mean that's definitely not a bad idea yeah if I did I think they will get fairly complex eventually so I'm just going to go ahead and give them their own page

  233. now actually now I just want to like ah okay I'm not going to get into it yet but I'm G I'm going to go back through and remove the admin part of all these CU there you go now that we de decided it's going to be like posts that it's going to be like a feed yes it's going to be like feed then like some yeah there's a difference between them so that will make us happy

  234. all right so that means that this is the wrong yep yeah see you could just my mind was already like who cares about admin all right post is a very ugly link um but we'll also need to create a new page correct yep uh create a new page and probably add something into our uh

  235. our create uh route or controller as well also true got to return that uh render yep the render okay so we want to add posts create. TSX maybe I'm sure there's like better let's see what I bet post folder like that's why there's this folder situation here cuz then you can say like create

  236. index all that kind of stuff which we will do at some point for sure all right but for now now we're going to go [Music] to post controller and inside of this function we are going to say return inertia

  237. render post create and here's so this is where things could get interesting right so that's saved we should be able to go here now let why is it mad at me now check the render method of inertia type is invalid po creat oh that's why because I

  238. made the page but I didn't put anything in it obviously that's it's a good way to so we'll just yank all that and go to post

  239. create there's not going to be any data whoa that's not what I wanted to delete in parenthesis so that was right all right and then

  240. there we go authenticated layout header I don't even know what that's going to be that is like that that little create oh the head is the head like the title of the oh so like now the tab is called create post but this is the actual element okay yep got it all right yeah that's part of like the layout that Brie scaff

  241. yep all right I've got like five more minutes okay no wor at all so can we make how easy is it to make forms in Lille it's it's pretty easy um because inertia gives us a form helper cool so that's helpful so in this uh in this page on post create what we can do is let's set up the form first and then we can have a store route that we push this to so we're going to now there isn't there isn't anything that we need to do

  242. in the initial like create controller method to like set up anything for like obviously if I want to do something custom or something sure but like there's no like something you need to have ready for forms to work on a page we would just have to in our controller in the store basically just say in the store function is where we're going to because that's like the post post to store okay yep so we do have to set up a route we we kind of like a post

  243. route yep post route and our controller do a store method and then this do the actual form makes sense to me so in here if we did the form it's going to be the import use form from inertia JS react MH that's it's going to be uh actually

  244. it's going to be destructured data first so like con yeah data set data post set data and post processing we have processing errors like we don't have to go into all that but gotcha okay so data is like all the fields set

  245. data lets us like pass the field name I would assume and like the the value that's being changed on the input to set it and then post is like we would call that in like a call back function on submit y for actual form yep so in the use form function we could destructure that into um an object of like our actual field so that would be like the title and

  246. description the data is that what you're saying yep or in in the use form function itself right up there oh like I could just straight up pull let's go and so that way you don't have to set up any like Ed state or anything the form helper helps us with that okay so like why is this being weird Okay insert I could just pull off um it would

  247. actually be in the use form like in the uh use form function at the end so that then pass that uh like the curly brackets so like for an an array or yeah and then that's where you could do yep title colon oh like default values y default values y oh exactly okay

  248. okay I think Source was the other one yeah Source cool perfect got it okay so default values then we would just need a like a submit function MH is there a special like form can do you just use like HTML

  249. form is there or is there like a form um I think it's just a form component a function itself so it we just like you know like function submit well yes I sorry I just meant for like um still get myself Tangled Up in all this right let's go back to okay um so yes there's a submit this would we would

  250. call A call back here um and this would be where we would call Post and we would so for for my reference what what what would callback do uh so for use callback so use callback is like a way of basically saying like um if you just assign a function to submit in JavaScript and react every

  251. time your component renders that function gets made all over again okay which can cause like a performance issue in your react code so you use call back for functions that should only change if like certain variables change uh so like so in this one like we would basically like oh your your mic just crashed

  252. again all right can you hear me still yep you're on a different mic but it's fine all right am I good now good now perfect call back basically it's like a performance it's like a performance thing um okay that makesense where where like if you want to make sure this function does not get re-instantiated every single render then like pass this dependency array and we will make sure

  253. that like it's performing as possible basically got it okay that makes sense okay so we have your L which I I would assume would be like in theory when we do so this wouldn't be would be similar to this this wouldn't be nam I don't I don't believe we can use like the Ziggy naming here we would just it would just be like the slash

  254. itself there might be ways to use it but yeah we can look into that but it would be like admin posts create y would it be method no because it's already post we don't have to tell the method cool okay and then does this automatically just send whatever the current data is or do we have to pass

  255. the data in yep no that is it as long as um uh the uh in the form itself that we're creating like in the HTML where we put our the values as data dot title data dot description gotcha Okay so I'm assuming we just use regular form yep you're correct

  256. cool and we don't even have to use any kind of method it would just be I mean you probably could but we could we could also uh like prevent default on that submit if we wanted to oh okay so that makes it like a it makes it not really it makes it like a uh by default like a a Ajax request instead of like a a standard yep yeah

  257. okay so this would you're saying so then what we would do is and then we'd have to prevent default on all of these no and then call submit got it yep yep yep here is where we would do all of our fun stuff of saying title just going to add a single field

  258. for right now just so we can get something that renders and then I got to run but this should be enough to get me going for sure um and be able to type text now I'd assume we'd want value to be data title M yep and then on change or does it yep on on on change is where you can set in

  259. that set data so you could do on change equals set data yep interesting okay cool I might do something I'm going to have to look some stuff up so there's a few things that like there's a few things like as a like a react person that I like I don't like about this the inertia form helper specifically uh yeah like just like the so like this is what is like defined as like controlled forms

  260. so like JavaScript is managing the values of all of these forms one thing that I like really like about like remix specifically on the front end you're just how it connects yeah you're just doing like regular forms yeah and like you it knows how to like pull the values out like it just tracks everything by default and what they do is like they have a custom form

  261. component that knows how to like pull all of that and behind the scenes send that off as a Ajax request first like they do like all the spa stuff for you um if they can but then it allows you to like fall back to just like a standard form submit if like it's got like that like what is it Progressive enhancement thing where it's like it tries to do an Ajax request that doesn't reload the whole page for Speed purposes but it falls back to just like a standard form

  262. submission yeah um who is which it when it's like javascript's disabled or like if there's some issue like the form submission still works it's just like a regular old HTML form submission whereas like when you do this route it's all JavaScript like there's no like using the web form submit stuff um yeah which I want to say like I saw something about that with inertia 2 changing changing how that works yeah I

  263. think but I'll have to I'll have to look into it yeah from what I uh know about Aur a lot of the changes well while it's not like that going to be that out of the box it's it helps push it to that direction in the sense of yes SSR and stuff like that cuz like right now you could do that and you could like build it out yourself but it's not any kind of helper functions currently for that yep yeah that's what that's what I will be I'd be curious to like try and dig into

  264. also I just made that up I don't know if that's right or not what's the set data yes the data be like or is it an object what's data function e Target out looks right right okay because cuz you have unchanged yeah onchange equ oh it's because input isn't closed

  265. off yeah I mean who finish who closes their tags I mean is that really even needed LOL all right that was a crunchy rooll where will works not sponsored by the way I guess maybe like kind of sponsored because will works there but not really yeah not sponsored I just this is a non-sponsored stream for fun because we yes 100% okay there we go you have a

  266. title there we go title and then let's say that we wanted to have this be like default now if we reloaded it would be default okay cool I like that love it yeah and then like and then now it's just like my prerogative to like add the stuff style the stuff yeah um you would have you would have one

  267. page and in your web routes that's like our our store request that's directing to the store request on the controller and the controller the cool thing with that is you're basically just getting the whole request as an object within our post controller and you would say post col and colon create request that's where you could also server side validate it as well saying okay the title that's where you would want to run all of like validations on things um

  268. cool okay well where where this is going to get is I'm going to I'm going to be I'm going to try and share as much of this as I go about it my on my own as well mostly because I'll probably need help along the way and so people can just like pitch in there but also like as I'm figuring stuff out I'm going to I'll be doing um I'm GNA store all like the images and media in Cloud Fair flare R2 and going to be like some wiring up

  269. of like media upload through form and react type stuff so lots of stuff to be figuring out yep and inertia has and does this did I read this correct that um Breeze comes with Tailwind Tailwind by default you're correct yep Oh yay okay cool awesome well now I just get to do the fun of like going back to all my projects and pulling in all my favorite

  270. components into here and so things look nice yeah are you Shad CN person then or are you something else uh I'm not I'm not I mean it's not that I'm not Shad Cen just like I generally write my own stuff most of the time your own special because I've got like yeah I've just got like components from past projects so much and when they're just like personal projects I generally keep a similar style across all of them so it's super easy just to like grab and pull

  271. everything in I like it your your stuff is always uh neatly designed I love it yes it it's just like if I know how to do it why not like all these things are incredible like shadan filament like all these tools that like do the design stuff for you so you can just get right to it but it's like part of the reason I do it is is to think about design and practice design so yeah sometimes I just

  272. skip right past them quick question before we leaveil somebody mentioned like ooh filament um what is like there is in in larl packages there is like this idea of of like your admin dashboard and like pre-built admin stuff is that what filament is or is that one of the other

  273. ones yeah so filament is a community package um and so larl does have their own official package for admins specifically admin panels called Nova and that's built with View and um inertia okay gotcha gotcha um type stuff and so that is like specifically geared towards hey this is an admin panel not specifically an app panel Builder and what filament I would say is probably

  274. like just a different direction while you can use it for admin panel strictly it's also built on live wire and it's specific for like everything else almost the thing of like okay if your users want to log into an a panel and have their own forms to to modify like for example I have a SAS application I've built out in filament because it has all the crud applications kind of built out for you yeah yeah and so yeah so I would say like they're they're kind of kind of

  275. not the same like a lot of people think they are it's kind of like one on top of the other gotcha okay well cool I'll have to check them out to see if there's anything that would because it's like I'm not I'm not technically here to design like the admin thing like I don't super super care about the admin part of it other than just like that it's there um but this looks like specifically Live Wire which I don't I don't care to get into so I'll probably be building a bunch of stuff yeah I I will say both for filament and and know but most of

  276. the time you're not really touching the front end stuff for either of them especially if you're just using admin panels a lot of times it's just strictly in PHP you're saying hey generate me this table in PHP and it's just pushing it to the front end for you so you don't have to mess with all it saying like hey give me a table both in Nova and filament like hey give me a table of all the posts and then it just gives you the options to edit it and delete nice because it has

  277. like file upload for you which is which is probably not the most fun thing to build out of the box especially when it comes with these methods for doing it automatically yeah and you can see here like in filament all that's just PHP it just shows you because you don't really touch the actual front and stuff for 90% of it for both of those oh okay that's super interesting I'll take a look at them I'm generally like a build everything in the these type of scenar

  278. like if I'm building it for like a for real like SAS application then like no why I'm not doing that um yeah but if it's like for like a project like this where like the goal is to learn then like I'm building it from scratch so I actually learn so this will be fun I'm going have to share along the way especially since those seem to be like not react focused I figured what could be interesting about me getting into larel is there don't seem to be just a

  279. ton of laral like react not that people don't use react I know there a ton of people who do use react but there's not a lot of ton there's not a ton of people who do like content in larl who are like sharing all about how they're doing stuff with react so I thought it might be like an interesting thing to like might be some place that I could help in the community since I do have such a bigger breadth of experience in like typescript and react that it might be

  280. might be interesting could definitely not be we'll find out but like I'm gonna have fun doing it yeah I'm I'm all I'm all for that especially with that nura nura 2 coming out there's going to be some yes a little bit of a fresh talking to um Joe tan bomb not well I I have talked to Joe about it um but no I've been talking with um oh my goodness why did I just completely blink it's been a long day

  281. um friend of friend of everyone in Georgia Jason just joined Jason J it was a j name it was just right there so Jason begs yeah I've been talking with Jason because I helped him with like a little react bug that they he was having building out something for the cloud um product with like toasts and stuff and he was like like a little a little poke around with like the uh they're using like a preview version of inertia 2

  282. already in cloud and it's it's going to be real nice so I'm pumped about it yep yep me too me too as someone who uh like I guess my my job for the most part is to get to know everything about lar as much as I can so I can't just be Livewire that's my preference but yeah I'm exced you're doing a great job Jos that's for sure it was super fun coming on here and helping me through all this it's definitely got me I think I've got like enough now to where it's like okay

  283. yeah I could work for a couple days and get a ton of stuff done before I run into something else that I'm like man I got no clue so there you go the cool thing is like you you're kind of similar to How You Like Remix in the sense of like okay hey here's justtin HTML while inertia might not be that on the front end just yet it's one of those things like okay all of your back end is the same thing where you're like you have the control you have the store push it so it's all just you could pass you could swap out inertia for anything

  284. else and you your your app wouldn't change gotcha cool that's nice yeah that's nice where like the back end the back end is is laral and nothing about that changes whereas like in JavaScript it's like everything changes if you try to even like switch from one thing to another in the ecosystem so y exactly this is going to be and like even with like databases like I could switch to like light or like not that you do but like yeah it's just changing drivers

  285. whereas changes like in JavaScript it's like nope you've got to rethink the entire way that you approach databases because you switched from Prisma to drizzle yep yep of course there's like some things some here and there where it's like foreign keys aren't sure available and something like that but yeah most everything is like hey I just in development I have SQL light and in production I have postr you need to after this you need to

  286. like check out Al allly just replied she said uh that's super cool he wants to build in lville but his wife wants to make sure he just grabs the soccer soccer bag before he leaves the house you just can't get we've got a we've got a soccer game tonight and very nice I've I'm the one who is responsible for getting everything out the door to meet them after school so there you go got go jump coach it up grab a bunch of soccer gear and go watch five-year-olds run around kicking a soccer ball it's going

  287. to be a fun one the absolute best Absolut absolutely appreciate it Josh thanks so much for for hopping on will I appreciate thank you everyone for uh for joining and all who uh who watch I'm going to head out as as well uh but uh yeah thanks so much will absolutely appreciate it Josh

just you here