Installing Laravel Nova From Scratch - Building Onramp in Laravel, Matt Stauffer Livestream

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
[Music] all right got a mic working got a new webcam got a weird little yellow thing up at the top of the chat I'm not sure what that is it's gone now look at that new camera I got a used Sony camcorder that I plugged in to a gato cam link and that's what we're doing right now all right hey everybody there's so many wonderful people who've been chatting already thank you all for hanging out glad to be back trying the pro mic today but we still are having issues with that I need to go buy a new little bolt thing right here oh do you see that that smiley is getting totally twisted in the chat and I don't know why yeah the picture quality in this thing is friggin crazy I'm very happy with it so oh I definitely have great there are there are quite a few I just got a haircut so it's hard to tell there are quite a few there are quite a few gray hairs in there alright so here's what we're doing I have actually put um I put the grip tape around it Wow look at that and if the focus actually works in this one too so I put grip tape around it and it helped a little bit but I need to put some more in so all right so here's what we're doing today oh you know I wanted to do I want to make sure that my my go live button sent out the tweet yes there we go cool all right so we're ready to go so oh you know what I was gonna do real quick I was going to do that thing where I take the notes as we go so let me get that ready it's been two weeks since I have done this and so it's gonna take a little bit of thinking to remember how this all works okay let's pull you all back on and oh you couldn't see that anyway because I had it on just on me alright focus yeah functioning focus is pretty fantastic alright so what are we doing today we are installing laravel Nova on on earth that's really the number one goal we will see where it's gonna go from there Hey look at that Thanks sinks sin x sin sin Nix chaos a little a little shimmy for that one we are going to install our Villanova from scratch so that if somebody has never worked with laravel Nova before they'll have an opportunity to see what that looks like and we actually need it because right now we're getting to the point where using PHP based cedars for all of our content is just not really functioning and it's getting more and more complicated and at some point we just need to be able to edit the content directly in the site additionally as soon as people can start checking off if they've completed something we can't constantly keep reseeding those because then the foreign keys on there like kind of completion checklist items will be wrong because you'll say hey I checked off item four and then we recede and all of a sudden item four is now item five so the moment we allow people to interact with these things that is the moment we have to stop using our entire current seating system and all changes in content instead have to happen in the database like a normal app best way to do that is Nova so why don't we do a little bit of Nova so first thing you do within strongly Ramona if anybody is not familiar with it larval Nova is an admin panel generator kind of tool it's not quite as CMS it's not quite a generator it's a in-between thing where you're making admin panels in code and the simplest way to install it is through composer and it's not quite thank you for subscribing Zolt guru guru I got that right so the easiest way to do it you can't quite do a composer require because it's an external repository that you actually have to specially link so what you do and like I said in my tweet where there's no work has been done thanks for following Robin Dirksen one there no work has been done off-camera so I have not touched Nova at all other than pulling up the docs before we got here today so let's go on to compose about Jason and somewhere in here I don't actually know where the canonical place is to put it sometimes I put at the top and sometimes for the bottom I'm gonna put it here today just because that's what I'm feeling like we are going to now teach it that if you look for basically go look here as a composer repository and so now we can come in here and then you can add this as a required element normally some people like to add all their projects to composer Jason like this this is actually not the best way to do it the best way to do it when you're not adding a special repository is to type composer require whatever the thing is because composer handles the require process better that way but when you have to do something like this this is actually the only way to do it so and I think one of the things that composure require does is it alphabetizes it for you so let's let's do that ourselves so we got Larry one over there and one of the reasons for that is you run composer update here you're not composer updating just Nova your composer updating the whole thing I think we could just run composer update layer well slash Nova but you know what it doesn't hurt to run a composer update it once in a while so let's just go do that and see what we get all right so so far that's the only things we've had now in order for Nova to function correctly you have to authenticate against Nova I think we might have to do it right here and so the best way to do that is to create an auth JSON file and so this composer update will probably fail because we haven't authenticated I'll probably ask for my username and password and they won't exist by the way I changed all of my colors in my terminal to be higher contrast so I hope that helps everybody see a little bit better but as always let me know if there's any other things I can do with the stream to make a little bit easier to see all right so let's go into on-ramp over here and we're gonna touch off Jason and I thought Jason get a nice little link here that teaches you how to do it and you want to create a file trying to remember how the best to do an auth that Jason I think I thought we had a prefilled one we don't so what I'm gonna do is I'm going to thank so today I'm gonna go mute real quick and I'm gonna grab an auth that Jason from another project and then just blank out the password so you all can see the syntax should look like what as my last project that I used I think I know which one yep okay cool so I'll show it here and also try and remember to put this in the show notes so let me take it and strip out the actual password first password here all right and let's throw that in the show notes and then I will bring it back over where you all can see it no it doesn't notion there we go cool all right so I can now put it back on for y'all and you can see it so this right here is what an auth dot JSON file looks like and this password right here could be your actual password for logging into the Nova website but also when you go into the nova settings you can go grab an api key I can't show you how because then you would see my API key but just going along in the nerville Nova website go into your little thing where you could change your password and down at the bottom there's a section that says something like API so you basically you're just gonna open up this off JSON file as you can see right here right identification required so that's not how we're gonna do it so instead you oops paste that's not what I wanted to copy copy this right here except that actually oh whatever it broke my uhm quotes oh it didn't break Michael yeah it did break my quotes and this is it you do it like this and then now when composer tries to pull that thing down it will pass it this information so now I'm gonna mute you all again I'm gonna throw my actual password in there and then hopefully I will remember to not actually cat this at any point later so that you all don't accidentally see my password and then I have to change it later which I would love to avoid okay so I'm going to pull you all that go pull y'all back on I'm gonna almost knock my vertical mouse off of the desk as I'm about to do alright or and run composer update again and I don't know if you hit ctrl C in the middle to compose or update did all of these updates fail and they have to rerun or not I'm not sure hey Andre English needs a better word for video mute censors definitely not the right word alright there we go so we now have Nova installed so let's so let's talk about those things we did created adjacent with our Nova API key installed Nova via composer all right what's next so you want to install it and then you want to migrate with all the new tables Jake says I have issues with stopping composer in middle and middle of an update and sometimes that Bork's the the cache sometimes so if that ever happens the easiest thing to do is just RM RF the vendor directory and sometimes it helps to type vendor correctly well a cop might be away but the problems black out seems to be more visual than audio all right so PHP artisan Nova install and then this posters out all the stuff basically into your Nova directory and so let's take a real quick look about what was actually just generated so if you go into app you're gonna see a Nova directory there and you're also gonna see a service provider which ends up here so your Nova service provider ends up here Teelin doesn't like it because it's some of the indenting here is not the tighten defaults I think that was it yep okay cool and then you also get some things under app / Nova and these are basically this is your base resource and we'll talk about what those are in a second and then your first resource which is the the the user resource we'll walk through that in just a second as well okay I'm wondering why this is it's not used oh it's nothing it's not used it's that it's sorted wrong okay cool so let's walk through these both really quickly not just that sometimes you need for first horse interesting clear cache Beach casts thanks so much and thanks for hanging out Beach cast all right so this is binding all of our basic routes you won't need to customize this most of the time so we have our authentication routes password reset routes that's gonna register those against your route source rider so yeah so Adam is saying this is one way to clear composer cash and you can take a look at that link in the chat if anybody's interested and then it registers a gate and the gate is the thing that defines who can see Nova on the production site now locally it's not gonna be issue but in production when I'm gonna do right now is basically if you're me then you get to use it and everybody else we will later to find who actually needs to go in there so we can actually do this right now and say allow non Matt admins you know who don't exist right now so it also come on sometimes it really bothers me when I make it difficult I want anything okay add the is admin flag or roles to users allowing on met admins to use never and will probably have multiple multiple levels of Nova as well and then this shows you basically the pages that are the cards and cards are like little you know chunks of little squares of data think about like a bootstrap you know card they'll show up on your dashboard when you log in and there's a Help card that comes by default and then you can also define how many dashboards there are and by default you're just gonna get the basic Nova dashboard we can add other ones later and then in the left side you're gonna see all your resources all your dashboards and then you're also going to see all your tools we can talk about those in a second don't worry about application services right now okay so there's a lot going on when you first look at Nova but let's just actually go login now we want to go to on-ramp test slash Nova and I owe you know we have to finish the rest of our commands so PHP I was in my grape is gonna migrate their database tables what is our error did I make a typo Oh interestingly Teelin told me to get rid of Nova I told me that Nova was sorted wrong and I assumed that it was telling me to get rid of Nova but it wasn't and I didn't actually go look at the error it was giving me so now let's bring it back okay cool so now we have these two tables added which come from which come from Nova and now we should be able to log into Nova you do have some other notes here make sure that the Nova service provider is added the providers or array and then this talks about if you put your direct your models into a different directory you need to make sure that the default user resource live somewhere else okay so let's go check to make sure that the nova service provider is in config apt up HP it is right there Nova service provider and then that's it so now let's go to excuse me let's go to on-ramp dot test slash Nova that was one of the things I was worried about is that the Nova routes are gonna get bound at the bottom and the problem is our language route definition route to web PHP is going to catch all of them so there are different ways to handle it one of them is to add a regular expression right here that says match any locales except the word Nova another one is to actually bind the Nova route right here another one is in the novus for a service provider you can change the route that Nova is actually going to be accessible via so I think what I'll probably end up doing is build the build the matcher here to make so that this locale does not actually you know go in front of Nova I think that's my favorite way to do it however having you all watch me write write a health regular expression is not the way I want to spend our time today so right now we're just going to assume that this now allows it to pass through and then later we'll write a regular expression so let's go add a note for that all right and so now we should be able to go over here and we should be able to see you know but this time the whole rest of the site is broken oh that's interesting oh no so I assume that the nova route is bound but it is instead forwarding us over oh you know why we also have a middleware that or is it the service provider that basically says hey if you go to a to a locale that doesn't exist then forward you over to luck look how that does exist where is that though is it a middleware anybody know stop your head it's been quite a while since I wrote that whole thing I've never worked with Nova and localized system this is Divi div V Y for siding windows so this is my first time running into this problem and so it's just gonna take me a second remember where I did this and figure out what the best solution is gonna be I kind of think that this is what's getting hit right here something's trying to resolve the locale it's discovering that the locale is not a valid locale and then it's throwing this invalid locale exception and when it throws this invalid locale exception then it redirects you to the root and so that being the case makes me think that we need to figure out what the best solution is to is going to be to allow nobody basically bypass the entire concept of locales there's dirty ways to do it and there's clean ways to do it but the problem is a clean way to do it is to no more than I think I do right now so what I'm gonna do right now is gonna I'm gonna do it a dirty way and then I'm gonna think about it a little bit later so basically we're gonna say allow Nova pass through and then to do see if there's a cleaner way and one of the things I do with to do is like this is I don't allow myself to merge something to master while there are still any to dues so this is a reminder to me later think about this but you don't have to think about it on the stream right now so it's gonna be something like this you know and then maybe something like that you know I don't know if that's gonna break something so let's just go take a look at see how that treats us and see if that was actually the problem there we go yeah so this is dirty but what it's allowing us to say is don't worry about locales if you're under the Nova route and so now this thing is just gonna stop farting at us and throwing this invalid locale exception and I'll think a little bit later about the best way to do it so we can do this we're dogging the lava ok so this is what Nova looks like by default although I don't see the help card here which makes me think we're getting an exception and say check it out this is exactly what I was thinking so we might start running into problems where the routes that Nova calls is running into our localization system which makes very broad blanket expectations that everything is going to begin with a locale and you see right here the server was one of the four oh four at /en which makes me think that it made a request and that request was redirected to slash en you should also whitelist Novus - API all right thank you and again this is not the cleanest way to do this we'll figure it out later but this is my first time doing Nova with localization Hey so you did it that was that was the solution and we were gonna find out eventually right oh we were gonna basically say wait a minute something's four oh four ring looking for slash again I bet that thing got forwarded over to /en because that's where you get forwarded to if you're accessing an invalid locale and so the invalid locale was Nova - API so Zolt let us know Oh Marisa you wonderful human being all right local regex to not catch Nova so this interestingly is not a regex to not catch Nova this is a regex - to match just two characters I think and I'm gonna be very very very transparent with everyone here I am a I am total goober Adam at Nova so this is this is both two characters I'll throw this up in the screen this is both two characters but some of our locales as Marissa is catching here aren't just en they're en - us and it's not actually true but it's something like that where I think I remember the one was Portuguese Brazil I don't know exactly what it was or something like that and so she's doing one where I'll put it up a little bit bigger looks like this and so in my incompetence you've got two characters that can be any any alpha and then optionally you can add an underscore and then two more characters it's not a - like I was typing it's an underscore so yep Marisa says it's PT PT and then two characters and then underscore - more so there is still one more part of regex that is going to be painful but let's just go through it together because hey if this is all about everybody's seeing how incompetent matt is and getting rid of their what's it called their impostor syndrome it's the best way to do it so laravel routing the the thing is it's not almost every single time I've ever worked with reg X there's been a question of do you have the correct slashes and everything thank you for following happy fruit and thanks for hanging out Larry Bell welcome so one of the problems that I always have with with reg X is that each syntax does or doesn't want you to pass in the quotes or the slashes or whatever else around it and so this right here it's not that match there's a different match this is none other ones were the ones W rtj I don't know what that means writing reg X is 90% my job well great so there's a way to do regular expression matching but I'm trying to remember what it is so if anybody knows off top of your head let me know I'm only gonna sit on this for about two more minutes so match is not it because match matches the verbs trying to remember what it is when you basically pass a parameter at the end that says only match it it's like this right here okay cool where regular expression constraints so let's just try it and the question here we'll be all right so we're and also can you do we're in a group so it's gonna be I think it was a current yep okay so we're locale bang and then arrow and then it's gonna be a regular expression here this is what I said what is what you said mobs welcome and thank you for scribing my for subscribing my friend all right back to here so we're grabbing this one and this was the one where I asked the question of whether or not we're gonna want these slashes here because that's what I said sometimes you do and sometimes you don't so let's see what happens right now does that break everything call the member function we're on a null so my guess is that the where is different on a route group than it is on a route and again I don't want to get stuck here for too long but let's see how interesting look at this this I did not know you can globally constrain a given locale by this and defiant here and I think that's really clever so in our route service provider we can actually define that anytime we're looking for the pattern locale we want to match it this way I like that a lot so let's grab that right there instead of throwing it in here I don't go too far this because I said this one was gonna be about Nova thanks no slashes okay so this is the route service provider we're looking at here it's gonna be the boot method right here we're gonna do this we're gonna say anytime I'm matching this locale method I'm gonna grab this with no slashes and try this and then now in our routes web dot PHP we should be able to have nowhere and still have it potentially map and I didn't know this exists at all that's very cool I love when things like this exist you didn't even know they were there alright so in theory it's working hey Marissa thank you so much for your help on that I really appreciate it so we got that snuck in there it's nice and good so let's add a note about this things we did we white listed locale to only match correct form so basically a tizzy 2 or a 2 Z to underscore a 2 Z 2 you can take that other things did you later come on great alright so let's go back to where we were do we need this still I think we do alright so we are on back ANOVA we are in our first ever know a thing and so one of the things you see when you get into know is you see this help card here and it just kind of gives you information about using Nova and then you get your resources and the only resource we have defined is the user resource and so what you get off of this user resource is basically it's binding directly to an eloquent model Teelin is complaining because we prefer using that syntax and then this is what's its primary title and so you're gonna say it's gonna be the name field alright and then which are the searchable columns off of it which by default are filled as the ID name and email and then which fields are actually gonna show up here so if we had a role or something like that and we want to show up as a column here we'll throw them in here but by default what you get here is actually very good and then when you actually go into the person that's when you can ask these questions of what filters can we so I got the filters would be on here they'd be in that um that drop-down there so we can make custom filters and only show me admins or only show me people who've completed or whatever and then you get into the cards which are on the page itself so various cards here where we can you know group segments of the the users information that we're editing here and then lenses and actions a lens is also sort of a way of looking at the things so a lens is a little bit like this page but a little bit more customized and then an action is something where if I want to click on this and be able to do things an action would be basically a button I could say are or make admin or something like that very easily rather than having to go in and edit them and add that you know that is admin field or something like that so why don't we add our first resource other than the default resource actually why don't we first commit what we've done primary title is used when you search these entities when the title or field should be shown it doesn't have to do anything of the tables fries no yep yep so the if I said that I'd said that incorrectly this title right here I was only pointing to show that it's this column this title is what's shown when you're we need for example if you're looking for this right here the title is what's shown right here but it's also shown when you're relating things to users or whatever else in their own edit fields and so for example if you were in something else that had a foreign key relationship to users and you were typing in the drop-down here to find Noelle Welch which is me then that would be whatever thing is shown as the label for that particular item when you're looking at it so yeah so let's go to github desktop real quick and just see what we did we actually have made a lot of changes not all of which are appropriate to stick around but that's okay we will catch those in the pull request phone all right so these are all just publish things from Nova so we can just kind of just call those good this is the Nova configuration where you can define what the name of our site is and why don't we actually go in there Figg Nova dot PHP what's our name hmm it's on-ramp and the URL is basically what's the base URL underneath everything and this is perfectly fine to be here because we handle people going to the root and forward over them to en this is where Nova lives so if we decided to fix all this by changing the Nova route like /en slash Nova or something this is where you would customize it some people always change this from the default so it's harder for people to sniff what thing you're using however this code base is open-source and I've screen the whole thing so if people want to know where Nova is they know where Nova is so there's no good there you can change which guard with authentication guard Nova uses and lots of other custom stuff in terms of like the middleware and stuff like that I don't need to worry about that any of that right now we're good all right config app dot PHP we added no service provider composers updated to ad Nova author Jason needs to be not committed oh goodness that would have been not good so we'll just throw it down to the bottom here it's going to be off Jason and so every person who is working in this project in the future will have to have their own aunt that Jason file or they will have to just type their username and password ever they run compose our update route service provider with Marissa's regimen regular expression thank you again nova service provider we already looked through the user resource the base resource we modified these happily to allow Nova and Oba PAP I through I added a comma because it was missing and I added author Jason to get ignore all right so install Nova and adjust localization to allow Nova routes push it up great okay so the next thing we can do is try and find what is our simplest possible resource and create a resource for it so I think our simplest possible resource is probably the track the track has the least related information compared to all the other resources we have so let's say we wanted to modify our tracks rename them or something like that so let's just try making a resource called track and I can't remember whether you're supposed to put the full name space in there so let's just try it out my guess is that there's parameters that you can pass in there what's the way that you say do you say help make resources that were it is yeah okay so pass in - - collection no we don't want a collection yeah I guess you can't pass it in so I don't know why I thought you could so artisan make resource track alright so we've got a track resource that just showed up why is your item state your name at Launchpad McQuack that's the name of my machine wait we're to track that PHP show up app HTTP resources Oh make resource is an API resource not a Nova resource let's see we've gotten it's probably Nova : resources what it is yeah okay help Nova resource not make resource because I know how to do things let's get rid of that one okay that's where I thought - - model equals model so we want to do is ours in Nova resource it's been a while since I've started a new Nova project from scratch so it's good to kind of remember the learning curve here so you want to name it track and then we want to say the model equals app slash track thank you all of my machines are named after Disney characters alright so just like we saw before we have a resource that relates to o all right so that was not the way to do it let's do it the right way so it seems to assume that you're already under the app directory so let's do this I always forgot that you needed to escape it but it looks like it already prepends that so let's see what happens when you do that you get app / track okay cool so again I prefer referring to the class this way okay and then the single value that should be used to represent it I believe tracks have a name yep tracts have a name so we wanna use name searchable things we want to have the name be searchable and we're really just modifying this to the same to have that same kind of base level of usefulness that we saw from the other one so let's go take a look at our Nova resource for the user and our Nova resource for the track and kind of see what similarities we have so these fields show up by default in the user resource to kind of both give us a useful user resource but also to show us what's possible with Nova so we're not gonna have a Gravatar but we will have a name so let's throw a name in there and that's really all the track has right now there are relationships that we can talk about a little bit later but really right now a track is just a name so let's just try this and see how it treats us what else do we need to do in order to get tracks to useful the moment you add a resource it gets added here let's click on it and oh app Nova text not found that was because I copied over the definition of this text thing without actually importing the class this is gonna be Nova fields text refresh and there we go so those are our three texts are our three tracks and so we can mix all sorts of changes to these but in essence that the main thing we would do is say WordPress developers you know there you go cool now we got the three of them we go back to treks and now we've got WordPress developers so it's the simplest stuff here so the next thing we could do is relationships but relationships are a little bit complicated so we're actually gonna throw in a couple of our other resources real quick to make them relatively easily editable before we get into resources our two relationships so also you can't relate something something without making the resource for it I will note that we don't wanna go too far down this direction because we have an active conversation happening on the the github issues right now about whether the ways in which modules and resources and skills will all relate to each other and we need to resolve that before we build out their Nova pages too far but you can always just change things afterwards so it's not that big of a deal okay so we will go make a resource for modules okay so just like we did with the track we'll come in here we will nope no VAR resource module dot PHP did I not create it correctly novo Oh cuz not no resources just Nova module okay cool so again / app slash module class we want to come in a module has a name we want name to be searchable and let's go look at modules and see if there's anything else we want searchable name is slug um I guess we can make slug searchable wouldn't hurt too much and interestingly oh this is gonna be interesting look at that create modules table how does Nova handle translated fields it might not this might be an opportunity for us to make pull requests either against the spicy package or to make some requests to the Nova folks to add that kind of stuff so let's just take a look I actually have one second everybody I have a request a question for my wife I'll be right back as a Jason field yeah but it's not Jason it's Jason that represents a translation so it's a little bit different so we'll see oh no I totally knew I was still on screen yeah I mean I figured like what else am I going to show y'all you can just look at what I'm doing thanks though Suzanna okay um so let's see what happens when we create a field for this translated thing talent whistle while you work thank you so let's just add name and slug real quick and then we'll kind of work on how so my guess is going to be it doesn't work we throw in the text for the name and we throw in the types of slug and names gonna fart because it's expecting text instead it's getting Jason or it just spits out the text as Jason analyzed but it's possible that's using some getters and so it actually might just work magically let's go look alright go over to modules import text of course just like last time now Nova text and then see what we get oh my goodness look at that so Nova is smart enough to be using eloquent to get the access ur and it says oh great this is it now I bet you that if we were to set our locale to Spanish you would actually see the Spanish name in there which is really interesting that does make a note to me that we need to make this name editable see that's a problem right there thank you for following there is no try love the Star Wars jokes so obviously we can't have somebody editing this and then saving us Jason because that would break everything so that's gonna definitely be the translation aspect is gonna make this whole thing a lot more complicated well that's okay somebody has probably figured out before and if not that will be an opportunity for us to maybe make a custom no bus or a package or something like that field type but it probably already exists honestly let's actually go see translatable feel adds a translatable field for this basi laravel translatable package take a look at that already exists I love it oh you people are so wonderful alright so that's what we're gonna use for those all right so let's actually pull this in well hold on let's get everything else working on the module and then we will pull that in all right we got a slug we've got a name we got a slug we got a name we can edit the slug the name is wrong because it needs to be translatable all right go team so let's now pull this package in so it was require mr. monette Noba translatable and then you add in this field just like this you have to have a house translations trait you've got a public transfer holder with all the names of attributes you want to make I think we have that already that's how we made it translatable in the first place I need to make their texts that make sure those translatable attributes are text or Jason which we have already done defining locales this right here we may have to import these locales over from the place we're storing them which is fine or we could run this like in an app service provider somewhere oh this we can pass this in directly to the field but for by default let's just see if we can have this just pull the UM the definition out of our locale class all right cool that works so let's replace this text for a name with a translatable and I'm not exactly sure how it's going to handle things like rules so for right now we're just gonna ignore them nova resource do you mean nova resources nova resource I'm not sure what you mean if you're talking about like ten minutes ago when I meant to type make resource instead of Nova resource then you're absolutely right and you might be watching the playback and putting comments live so I'll assume that and tell you tell me otherwise okay so what we need to do is define our locales and config translatable config translatable so it looks to me like this thing is going to be reading that but we're not using it right now so let's give it a look my guess is that the spot c translatable package gives you the option of this but it doesn't require it whereas this plug-in actually requires it so let's go here throw in our locales and then we want to pull these locales out of our I think our it's in the locale class yep locale locales so what we want is this array exactly so we don't want slugs we don't want is valid we won't languish for a cow so we need a new method doesn't exist so let's just call this function locales this locales might be better to be named all actually let's make it all for now and this can basically return this locales all right and then from here we want to say new app localization locale all see how that treats us all right let's just go real quick check our test and see if we've broken anything yet we probably have at least through one of these things great to see you again catch me thanks for hanging out we syntax error yeah so interestingly I noticed this earlier if anybody is bored would you go take a look at line 167 in the database seeds learned up PHP file I run this error like two minutes before we went live and so I didn't have the chance to go fix it it says unexpected comma expecting semicolon so hopefully if you pull down master right now this is just a little typo in the syntax there that I didn't catch so if anybody's bored and don't worry about it if you're not bored go fix that for me but otherwise I'll test see me looking great so okay is it worth moving little cows to configure this to the class prop for config cash purposes that's a interesting question I don't think that this is gonna keep config cash from being able to cash the output of this so I think it's gonna be fine but you know if we discover that's not the case then we can always talk about moving it and this this can pull it out of this instead that we can we can flip it over if we want but right now I think we're gonna be okay m/s all right cool so this makes the name not look right so that makes me suspect that it's not configured correctly but let's go take a look now that is friggin cool yeah I like that a lot so let's look at our basic testing module and give it something in you know I speak enough German to to say some things but not basic testing so let's just say you know let's make it look very German oops where's my egg that's German right just remove that line and it appears to fix the learn dot php' okay so there must be an extra ending semicolon seeds thanks Marissa learn dot PHP so it's line 167 so somehow indentation got off here and that was the problems let's see is there really clear if we look here where the invitation should be so weird - dents there students there at this one I think these ones just got indented in too far it's my guess what happened I don't know how that happened but man who knows but if that fixed it then all we have to do is just reformat it later illegal string offset name okay I don't think that just that alone didn't fix the problem so I again I'm not gonna waste our time on this right now so okay cool so alright we got our German let's see if it sticks around well alright great so we've got our German translation or English translation I don't love the fact that we don't get to oh this is cool you even see it in the preview version very nice work mr. Mohn at Lucca I really like that a lot okay so or what I was saying is I don't like the fact that on the listing we don't see the name and let's see if we get any more information about that in here single line option by default the input field and data view is a texture if you change the single line you can add a single line yeah I mean it's we don't need it it's just it's just a name right so let's go in here and use the single line option we don't need the tricks in editor okay by default the locale used when displaying the field and in excuse determined by app get locale to override this you can use the index locale that's interesting because I'm pretty sure that we should have a locale of en right now but because doesn't don't you get to do a fallback locale and config yeah so the locale should be set to en here and it should be pulling the en version there so we'll try this right here where it says in ex locality in but we shouldn't have to be doing that right now so I'm kind of surprised and maybe we found a bug there let's just take a look oops refresh this one yeah so that shouldn't be necessary no where's Marisa again don't merge the master with two Do's in it but also don't waste your time on streams hacking on things that aren't necessarily necessary all right line 160 want to learn dot PHP is missing an opening bracket thank you so much for taking a look at this because this way we can get done with this work today with PHP unit actually happy alright so this was learn know see learn PHP line 161 let's miss it look at that missing an Open bracket just like you said perfection thank you so much all right so let's merge actually you know what let's fix that on master all right so what have we done I should just go to get up desktop or real quick fix that on master and then merge that master into here so we added translatable add Nova translatable field and use it for module name all right go over here and then we're gonna go check out master real quick we're gonna make that fix on learn dot PHP I'm sorry get check out I'm trying to stop using my shortcuts I get check out master we've got a whole bunch of things that man okay I think I can just yeah I'll just ignore that one uh-oh I break something why something calling all oh I was modifying the translatable by PHP in the vendor instead of in the local config so of course that didn't work let's let's undo that and now it'll work fine okay great so let's go back to our branch mes slash install Nova and let's fix this are we falling back to en locale no I we are because the en locale the fallback look house should always be the one that's could defined and config app dot PHP and that right now is set to yeah right here as is the fallback locale so alright so what we just ran into there if we ran into multiple things but first of all let's actually emerge master ok great now we should have that PHP unit thing fixed but we'll need to real quick go back and add and config translatable dot PHP I don't know why we have a custom fallback locale in here when we already have one and can figure out the HP but I'm not gonna fuss about it too much okay here we go everything's working again so what do we just change we so just remember GAC right here that I keep using I'm gonna try to do is get add everything and then get commit with a message and so I just shortcut that to get because I do it all day long so the message is here we customize translatable package to use on-ramp locales okay so tests pass Nova Works falls back to English shouldn't but it's okay I left um or should we shouldn't had to customize it here but it's okay I left a note in the deal all right so now we this really really really really clever thing and I'm really grateful for Lou cutter for making that got a slug and now let's see in eleven minutes can we do a relationship oh he won't seen that server try reloading the page okay that's annoying which is weird because you all that is showing the latest all right how do I fix that can I hit the refresh button to refresh caches page okay hopefully the next chat message somebody sends will show back up in the chat I don't know why I was showing that error or how long thank you for following our one SSS I need to switch up that thing so thanks Susanna yep all right we're back alright in 11 minutes ten minutes and out in ten minutes can we make these things relate to each other the big question is what do we use to have a track relate to a module and is it going to be one of the harder ones because if so it might actually be worth not working on one of the more complicated ones but instead on one of the simpler ones so app tracked at PHP has many modules okay let's just try it I don't think we'll have that much trouble so basically when you come in here in the Nova Docs when you get down far enough you're gonna see the basics but then fields and fields is really the biggest kind of place where you're gonna do your initial customization you make the resources and then you make a field for all of your individual columns and so here's all the basic fields you got avatars and all that kind of stuff dates uploads and you can get way more at Nova packages com but then you move down to the relationships files okay so has many right so that's a simpler one we start here and so what we're gonna do is make a has many for the thing when defining has many use the plural form of the relationship and this is going to be based on inferring basically this right here so you're basically gonna say whatever the relationship is defined in your eloquent model do that same thing here so let's go to our first our resource for track again I keep doing that know about track dot PHP and we're gonna add a new one down here has many for resources typing is hard typing is hard all right and then this time we're gonna remember to import it and let's see where that gets us on the track resource alright access to undeclared static property a nova resource model so this is expecting us why is this undefined can I not know of our resource oops Nova Oh awesome so we have a problem the problem is that Nova calls its base thing resources and we have a thing called resources thankfully Jonas yes you're right it should be modules but we are going to run into a problem that we have an element in our thing called resource and so we're gonna have to figure out how to handle the fact that the base Nova thing is called a resource my hope is that we can just name this something else because this is our class and so we can have all of our things basically saying like base resources something like that hopefully thankfully this is just for today this is just a typo I should have made this modules not resources right but that could make life interesting later so but let's see how this treats us for now all right under unknown column modules track ID and work clause and this was where I was thinking I think that the relationship between a a track and its modules is actually not standard the way we said it resource ish and so I don't think our now create module table yeah it's not actually a I think it's a many-to-many and so I think there's if so I'm trying to move as slowly as I can sorry everybody for rushing it's hard to both want to solve something quickly and then also explain it well so I I start with that sometimes so you're gonna see a module track table right here and so this basically says the relationships between module some tracks as it expects it to be here would that there's a track ID column on the modules table which would be like a one-to-many but this isn't a one-to-many it's a many-to-many which means we were using the wrong one and so the interesting thing is the many-to-many relationships in nova it mate so like I said so if anybody hasn't been following us the whole time we went back and forth about whether a lot of the different relationships in know and in on-ramp were polymorphic many amenity or polymorphic one-to-many or many many non polymorphic and I think what we ended up with was some a little bit less than standard implementations I kind of am surprised because I didn't think this is one of them so let's just step back for a second has many right belongs to belongs to many this is well you know what this might actually just be raw yeah we might just not have used it yet I think that's what it is I don't think this is as many and and I was just looking at being like I feel like this is this is the wrong one let's see we pulled tracks off here yeah okay so I think it's actually gonna be belongs to many on both sides so let's just try and my gut says that this thing right here we wrote but we're never actually used which means we haven't tested it either manually or in an automated way so we're gonna go in here and say let's assume that I wrote that and didn't test it and we were just saying oh yeah it's the thing that we're gonna add later and let's assume that this is actually anybody along belongs to many and see how it treats us and if that doesn't work we got five minutes left today and I will figure out what I was doing wrong um what what's most likely honestly is that somebody will figure it out in the YouTube replay and then leave me comments that will sit around for the rest of my life telling me wasn't it super obvious to you and I'll go no it wasn't super obvious to me but thank you for making me feel like an idiot man thanks man I'm very new to no this is very helpful how fast you're through problems right well thank you I would if I were working through fast this one would be done and one of the things that we've all learned here is that oh you know okay because these belongs to many like I said needs to so let's assume basically I would i if i were really someone who was helpful and inspirational here i would understand the differences here better okay this is what it was yeah so I was right the problem was that I had written that has many on the track without actually using it which is why you shouldn't do and we were probably building out the track one one day I said oh yeah I'll just throw these in here forgetting at that point that that was a many-to-many not a one-to-many and I now this morning I open her up and I said oh it must be a one-to-many because there's a has many there but it's really just because I typed it in never tested it and so that kind of threw me it put me down the wrong road right I thought it was breaking because of some other reason and because I was just forgetting the syntax I actually had the syntax right in my mind and that code was wrong and that led me down the wrong way working on cameras about 3x harder oh my god y'all have no idea thank you so much Stefan are Stefan I really appreciate it have a great day all right so three more minutes so what we can see here is this is what it looks like when you have a relationship in in these so your track you go into your individual track and you can now see which modules are attached to that track then you can go into that module itself and we can also later divine like which pivot fields we have in these and stuff like that but this is really cool because you can now also attach other modules to this track you can detach this some of these modules from this track so lots of interesting stuff you can do I can't remember I think if you did yeah it see this is detached not delete and so we can attach and detach things here and we can actually search let's say you have like a couple hundred of them you can say well which of these do I actually want to see and then it filters it down right there so really clever user interface things that you get basically for free out of Nova assuming you actually understand how relationships work and laravel and then the last thing you could do is you go over the module and you can do the inverse and you can pray that you are less dumb than you were ten minutes ago and and try it out so let's try the exact same thing on modules can we say belongs to many tracks boom and so now we can say well what if one of these modules is attached to multiple tracks which happens often for example basic testing shouldn't just go for WordPress developers it should also go for front-end developers and it should also go for new to programming all right so now let's go back to our modules we were on basic testing let's take a look at it and now basic testing has attached to all of them just like that frickin magic I love it ok let's go make some episode notes created resources for modules and tracks the tracks modules relationship all right we create resources modules and tracks we related the modules and tracks resources we brought in nova translatable package to make it easy to edit translatable fields and nova um that might have been everything we did yep thank you for following must grab mike a little shimmying shack for you are a late tracks and modules in nova fix track module relationship great so last thing we do is we run our tests boom thank you for following know vollis so tests pass we have nova functioning we've got notes for what we did we will not merge this and actually let's let's say another thing to fix all to dues and then merge so I won't merge this up until I am i clear out all those to do this real quick and then I'll push it up next week on Tuesday I will be doing first entry in a new series where I start pair programming with someone who's a little bit newer at laravel than I am and will work on something new together and they'll ask me the questions and and then next Friday we'll get back in ANOVA so I have some other plans for what we're gonna do in Nova but I would love for all y'all to come with questions what do you want to learn about NOAA what have you never done before and if nobody has any questions that what we'll do is just continue building out the rest of the resources and also setup user roles so that other people can get in ANOVA once we're done with that then we'll be able to actually start administering the relationships all these things um thanks for following happy four six seven and that's gonna be great so thank you all for hanging out let me remember all the things I do at the end I pause on me you see the high fidelity of my new camera although it's totally not centered Monday not Tuesday yes next Monday thank you next Monday and Monday is actually gonna be not at my normal time Monday will be I think at 2:45 Eastern instead of 11:00 Eastern and then Friday will be back at 11:00 Eastern spot see has a translatable package for ANOVA as well okay cool so yeah I think that's it for today so thank you all so much for hanging out I love it also I'm trying to put out a youtube video every Monday that is more just kind of me talking to the camera and so if you don't subscribe on YouTube even here it's just twitch fall or go subscribe on youtube youtube.com slash Matt Stafford because you'll get notifications about all those as well I will not tell your boss at all that I was here during work that you were hearing during work okay so now remember what are all the outro things see you you all can hear
Info
Channel: Matt Stauffer
Views: 3,028
Rating: undefined out of 5
Keywords: development, education, laravel, laravel for beginners, laravel learning, laravel tutorial, learning, learning laravel, live, live coding, live stream, livestream, matt stauffer livestream, onramp to laravel, onramp.dev, php, programming, vue js, laravel nova, learning laravel nova, installing laravel nova, getting start with laravel lova, learn laravel nova, laravel nova tutorial, laravel admin tutorial, laravel admin panel crud, laravel admin dashboard, laravel admin panel generator
Id: cTW7ocyoDKA
Channel Id: undefined
Length: 62min 28sec (3748 seconds)
Published: Fri Nov 01 2019
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.