Taylor Otwell - Keynote

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments

Looks incredible! Very disappointing about the proprietary license, however. This is a product that clearly warrants the license fees, but I would prefer to collect them while keeping it open-source. Unfortunately I know it's next to impossible to get a client to pay for open source software.

It seems like a compromise could have been made. Keep the core open source, but sell a support package that includes proprietary fields, like the fancy edit controls or search integration. Something that would let developers bring this to our clients and say, "Look, we need this. It doesn't cost very much, and will save you a lot of money in the end."

Unfortunately, as really cool as this looks, CRUD is still the most boring part of our jobs, and it really shows in the lack of excitement in this presentation!

πŸ‘οΈŽ︎ 16 πŸ‘€οΈŽ︎ u/hackel πŸ“…οΈŽ︎ Jul 26 2018 πŸ—«︎ replies

Wow, that’s cool. RIP Backpack for Laravel I guess.

πŸ‘οΈŽ︎ 7 πŸ‘€οΈŽ︎ u/stuckinspace πŸ“…οΈŽ︎ Jul 26 2018 πŸ—«︎ replies

Totally worth the money.

πŸ‘οΈŽ︎ 7 πŸ‘€οΈŽ︎ u/FlevasGR πŸ“…οΈŽ︎ Jul 26 2018 πŸ—«︎ replies

I attended this talk yesterday. It does suck a little that it's not free, but at my job we recently lost 1/2 our JS team and i think laravel Nova is gonna mean that we're not going to need to rehire them. It's game changing.

πŸ‘οΈŽ︎ 5 πŸ‘€οΈŽ︎ u/holyshock πŸ“…οΈŽ︎ Jul 26 2018 πŸ—«︎ replies

Would be nice if they added a free version that was barebones. Something like simple administrator management; add & disable accounts. Something like what Django offers that would be completely free. Then leaving the door open to upgrade.

πŸ‘οΈŽ︎ 6 πŸ‘€οΈŽ︎ u/TopBantsman πŸ“…οΈŽ︎ Jul 26 2018 πŸ—«︎ replies

I wonder if it is paid will anybody from the community build packages for it and give them for free? However its obvious that Laravel Nova simplifies things a lot!

πŸ‘οΈŽ︎ 1 πŸ‘€οΈŽ︎ u/crypt0lover πŸ“…οΈŽ︎ Jul 26 2018 πŸ—«︎ replies
Captions
folks give it up for Taylor OTT well [Applause] alright thanks for coming it's a last talk of the day so be sure to stick around for the after party afterwards I'll have lots of food and drinks and you can check out the science exhibits and stuff like that so this is the sixth layer icon and I think it's about the 12th like this is a six layer con u.s. I think it's the twelfth Larrick on around the world who was at the very first Larrick on in washington DC see a couple hands I think we only had 90 people and then we went to New York which is where well at DC I announced that laravel 4.0 was coming the next May and we went to New York in 2014 I think and that's when laravel Forge and homestead were announced and we had about 250 people and then we went to Louisville and announced laravel spark and the next year at 2015 and that was about 550 people then the next year we had also in Louisville laravel passport laravel Scout laravel notifications and I think laravel echo baby was all of that year and then of course last year in New York was laravel horizon and this is the biggest lyric Anya in 2018 with 850 people so thankful for coming I know it's a big investment to buy tickets and fly across the country and stuff like that [Applause] so just a quick update on what's been happening in the laravel world if you keep up with the release cycle you know that we have a release every six months so that means we have a release in February in August so typically the releases come out at lirik on EU and I kind of demo some stuff here at Larrick on us and it comes out the following months and as the framework has matured you know the releases have gotten sort of less radical if you've been around since like laravel 1 for example less radical than the jumps from laravel 1 to 2 to 3 and even to 4 and 5 and the releases are usually you know simple upgrades now and have nice convenient features but they're not really paradigm-shifting updates like there used to be so what does that mean for laravel 5.7 which will come out in August the changes the breaking changes are pretty minimal most people will probably be able to upgrade and you know just 5 minutes or so just like you did to learn about 5.6 but there are a few features I wanted to point out to start out the talk one really requested feature over the years has been email verification so when Larry about 5.7 there's a new interface that you can mark your user models with it says must verify email and what this does is if you use make off to generate the AA scaffolding this gives you when someone signs up they'll be redirected to an e-mail verification kind of page that tells them they need to check their email click the verification link and then they'll be ready to use the system so you don't really have to code that by hand anymore which hopefully makes a lot of people happy that's been a pretty popular feature request [Applause] policies have a new feature we're using the new PHP 7.2 I believe was this version optional type pants you can specify that a policy can be called with so-called guest users that aren't logged in so basically it would be null we'd be passed in as user this is sort of an edge case scenario but also sort of a highly requested feature that will be coming and Lehr about 5.7 another feature that I think is really cool is the dump server from Symphony has been ported over into laravel so how this works is you do artisan dump server dump - server and then if you have like little dump function calls throughout your code they don't actually go to the browser they get displayed in this terminal window and it shows you where they come came from what file what line and sort of what got dumped out so it's actually really handy little feature if you're used to it kind of garbling up your HTML it doesn't really have to do that anymore so that's really cool see there's a handful of other small quality-of-life improvements tuple syntax for route action URLs easier fly system streams and a few other things but overall it's a you know pretty much a maintenance release with a few nice convenient features and typically I would demo some of this this stuff but there's a lot of other stuff to talk about today that we need to kind of dig into which is what I've been kind of working on for the last few months along with Steve sugar the laravel designer and David Hemphill who kind of teamed up with me on it and that is laravel Nova so what is it and there's been a lot of guesses on what this is crypto currencies dating apps all kinds of things but I can I'm just gonna walk through it with a demo we can just take a look at it right now and you can see it firsthand so laravel Nova is a really beautiful looking admin system for laravel back in the admin panel [Applause] so I want you to get all the bad memories of bad admin panels that you've ever experienced out of your head because I feel like we really sweat the small stuff with laravel Nova and really put a lot of thought into how we wanted it to work and how it should work and I think it created a pretty refined product that you're really gonna like so Nova like I said it's all custom design this isn't like some bootstrap clunky admin that you might be used to and its installed as a composer package just into any level application so you can use this with existing laravel applications it's sort of unlike spark which sort of entangles itself in your application so to speak and you sort of that's sort of the deal you make with using spark writers that you're agreeing to sort of let spark control all your settings pages and billing for the benefit of saving all this time and it's kind of totally different with Nova nobody sits beside your application you don't touch your existing code at all actually and just gives you this really nice admin panel to explore all your data so yeah so this is sort of what it looks like when you install Nova it's built as a single pageview application using tailwind CSS by Adam Wathan and of course a laravel json api is feeding it all this data and when we jump right in you can see we get this list of resources over here on the side and if I jump into here I get of course just a nice index of my users and let's take a look at what that looks like on the back end because like how I said this doesn't interact with your code so each eloquent model in my Nova directory has a corresponding resource so here I have a user resource that just has a fields method that where I'm defying the fields I want to display and Nova fruit so in this case I'm showing the ID a Gravatar which is just sort of a virtual field it doesn't correspond to anything in the database but it uses your database to calculate the Gravatar URL and display it in the index of course the name the email the password and a few other fields which we'll get into later all right so it's not hooking into my L it's not storing any configuration in the database like you know more like a CMS might do it's a purely code driven everything you do is in simple PHP classes there's no funky database structure or anything that it creates all right and so of course if we go back to this index it's it's searchable so I can search for atom and get really quick search results I can search by IDs and get search results it's sortable if the field is marked as sortable I can quickly sort through my data and by whatever fields I want and it just feels really snappy and quick to use with it being a single pageview application all right so if I drill down into an individual user let's say me I get this nice detail page and what's really cool is some some admin panels you just get sort of this user but what's nice about Nova is I get really great insight into my relationships right from this detail page and can even paginate through them search them so this search is scoped to this user so if I search for that ID of course I get a result because I have one but if I search for an ID that doesn't belong to me I don't get that so it's really quick to dig into the models relationships and explore the data alright and on this detail page you can even group fields into separate panels if you wanted to so if I come into my Nova resource again my list of fields let's just make a new panel here called extra fields let's say and I'll just move these two fields into here for now all right let's import that panel class you see this just creates an extra panel so if you have a lot of fields it can be nice to break those up into extra panels so they're easier to read all right so I'm gonna go ahead and just get that out of there so we don't really need that for now you can see these fields I'm hiding from the index so I can control what fields are actually going to be displayed on the index which fields are going to be displayed on the detail screen which feels are going to be only on the form screen maybe and have pretty fine-grained control over that alright so if i refresh that that panel begone of course we can create entirely new resources like you would expect from sort of a crud admin panel type of thing so if I go to my post resource let's say and of course here this belongs to a user so I get a nice link to the user that owns this post so I can dig into that and of course I can just create a new post here where I can select the user that I want to associate this post with so maybe with a tailor out well and then post title the post body and give it a publish that date and just create that post and I go to this post detail screen now for these text areas you can see I can expand the content of this text area doesn't always show it on the details screen so it's not really bloating up the screen all the time it's only there when you need it what's also cool is in this example I created the post from the post index but say I'm viewing a user I can hop into that user skip down here to post hit create post and that users already locked in there with that field so now I can just create my new post just like that it all feels really fast and snappy to use as you're using it with it being so you know richly built on the client side and every type of relationship is supported and know so of course this is a simple blog Stu has many type of relationship but if you need to update update the pivot data on a polymorphic many-to-many soft deleting relationship that's going to work just as easily and we'll dig into some of those more advanced relationships in a minute updating resources of course we can do that if I hop into my detail screen this time you're going to hit the e key for edit to hop into the edit mode and of course can update anything we want to do here and of course our data is updated and see what's great is these are just eloquent operations behind the scenes right there's no it's not a bunch of crazy magic necessarily happen happening behind the scenes so what that means is you can still hook observers into your eloquent models and interact with all of these events that are happening in Nova so in this example I have a user observer that's listening for this updated event and I'm just going to write to the log file that the user was updated when this runs so my log file up here we already see a couple of updates I'll clear those out but since this is attached to the user if I edit this user of course that event is going to be handle is going to write to the log so you can listen to all the events they're updating updated restoring or stored you know deleting all of that and hook into different aspects of what's going on in your system all right and so we saw that users have validation rules here like for example I can assign different creation rules different update rules or sometimes the rules are the same so I just call it with one method and of course nobody's gonna handle displaying all those rules for you so I'll fade update user I get a nice validation error there so you have great control over validation and of course you can use the closures for validation for the custom rule objects all the same rules that you would not use in a normal level application are available to you in Nova another aspect of the update is we have support for warning users or blocking users from updating a post if it's been updated since they started editing the post or whatever resource they're updating in this case it's a post but it could be like say a server if you're running an application like forge um I could go into this server five let's pull that up in the database here I have this servers table and for number five I'm just gonna say that it was updated some for day in the future that's gonna be you know beyond when I'm gonna update it and if I try to update that I get this error that another users updated the resources this page was loaded so I can't like overwrite stuff I mean you know unintentionally so to speak so that's all baked right in and you don't have to really worry about that [Applause] of course we can delete users we can delete users from the index or we can delete them from the detail page so I can select a few users here and or select all matching and then delete the selected just like that now select all matching what that means is say I do a search for like ID of two and I hit select all matching it will select every resource matching the current filter state or search or however you want to think about it so even if they're not all displayed on this page even if it's paginated and then I can hit delete selected and that will be gone and I'll clear my search so that's really handy if you want to do a search and then delete everything matching that search you can do it really quickly right there from the UI what about soft delete so soft leaves are another feature in laravel where when you delete a model it just sets the deleted at column on the database to the current date of whenever you're deleting it and it doesn't actually remove it from the database so in this case I deleted some users so they're missing let me receive my database here so in this case posts are marked as soft deleting if we looked at that eloquent model so this is marked as soft delete with a soft delete straight if I jump into this and hit delete on this post it's gone but since this resource is soft deleting nova knows to let me show which trashed or only trashed or just the default state of hiding in a trashed model so if it whit trashed we'll see that comes back and now I have a nice restore icon here instead of at lead icon and I can just restore that model right there we tried to make everything work really smooth and really intuitive so let's go ahead and we can also do you know a batch delete or a batch yeah batch delete here like I did on the other page and of course this is a soft deleting we have a new option here to force delete the selected resources so here I'm just going to delete these and then since we're still in the with trash date there they all are or I could jump to only trashed and there of course we only get the soft deleted models when I go ahead and select all the matching ones there restore selected and this should be back into the table alright so it's really fast to interact with soft deleted models really makes it a breeze so you sorry I have to look down on my notes there's just so much to cover I need to kind of keep myself on track here so when stuff is trashed of course our our search is sort of respecting the filter state they all work together so if I'm not showing the trash models and I search for that ID I'm not gonna get it whereas if I do this you know the search shows up and then all these URLs can be permalinks so you can send this link to someone and they'll get exactly the screen you're seeing even though you've done quite a few client-side operations we try to make it where you can link directly to the view you're seeing at all times all right so that's sort of the basic create read update delete scenarios kind of the core skeleton of the crud aspect of Nova so let's jump in I want to look at a few other fields before we move on to other stuff we've seen you know the basic feels like text area and text box so far but there's some really cool other fields I want to jump into so let's go back to the posts screen and look at that date field what's really cool about this is let's go ahead and see that publish that it's is set in Chicago time right now on the front end but in my database that's actually UTC time and so what Nova is doing is intelligently localizing the dates on the front so that if I was in Europe I would see it in my time 24-hour time I wouldn't see a.m. p.m. and you can configure what timezone if you like you have a user time zone on your database table you could say I always use this time zone for this user but by default it's just going to use my browser settings to give me the time that makes sense to me and the same way when I'm editing this post I just set the publish time at a time that makes sense for my time zone and Nova will take care of getting it to UTC or whatever your time zone is in the backend automatically so if I set this to you know July 24th at noon update that post and I look at this in the database see if I can make well I don't know if I can make that bigger but the updated at or the published at is 1700 it's not noon so it's been offset by the correct time zone offset and you don't really have to worry but I all just worked for your users it works for you and it makes sense so we try to make those little details really work very cleanly so that it's a really clean product so let's explore another field so our blog text area we can spruce that up a little bit we don't just have to use a plain text area so let's go into our post resource again remember this is just a class that corresponds to our eloquent model each eloquent model usually has one Nova resource that sort of describes how I should look in Nova it doesn't you don't change your actual model code that all stays the same alright so right now I'm using the text area field but we can easily switch that to say a markdown field let's import that now when I edit this I get this nice markdown editor [Applause] so I can add some markdown text in a nice preview of the markdown here supports of course bold italic images lists tables all the stuff you would want to do and markdown and I can just update that posts and just like the text area we get a nice you know hide and show content here so it just works really nice but maybe markdowns not your thing we can do a trips field from base camp it's another cool editor it's hopping to edit and now we have a tricks filled tricks editor so we can select that text and hit bold thanks for clapping it's keeping me encouraged actually it's high energy the user table has a column that I haven't been showing in novi yet but there's actually if I look at that migration I have this options column that's a text field and what I'm wanting to do with this column is distort JSON in it so it's just gonna be a JSON object that contains that users like preferences or options because I don't want to call them for each individual option that I may add to my app if any of you ever made like I call them kind of like this yes/no okay so if I hop into the this user thing use a resource like I said I don't have anything to find for that list so let's go ahead and do that and I have a little snippet here I think I can just grab code fields in a bit okay and let's put that under country let's say go ahead and make sure that's imported and I'm gonna say code make options and I'm gonna say this is gonna be JSON so I'm gonna chain that JSON method on and I'm just gonna use the JSON laravel validation rule to make sure that it's valid JSON coming into the server now let's take a look at our at our users all right so Larry Moe is kind of intelligent about what it will show on the index by default so like a text if you add a text field to a resource that's gonna be on the index by default unless you say don't show this on the index but if you show if you put like a text area or like a code field or a markdown field on a resource Nova knows that never makes sense on the index like you're never gonna put a you know a big block of code right in your index so it knows to just hide that unless you tell it to show it on the index but if I hop into this user now and it it forget this nice code editor [Applause] now I get a nice display of my JSON data but we wouldn't have to store it JSON in this field we could paste a big chunk of PHP in there like we couldn't even probably just grab this file just kind of going off the cuff here but and of course we want to remove some validation stuff so I think when you do something like you can control what language alright let's give this a shot so you get a nice code field nice syntax highlighting right there in your admin dashboard all right I'm gonna remove remove that field for now can I get back to my clean slate let's take another look look at another kind of field which is a file field for file uploads of course mini apps except file uploads it's gonna blow out all those changes we may have done there and I'm gonna switch to a file field branch here receive my database all right and here I have a photo resource which I created just on this branch and if I look at that back-end know of a photo in the fields you see I have the usual ID field name field which is sortable I'm gonna be storing the original name from the client and I'm also going to be storing the size and the size I'm passing in a closure that I want to use to format that size on the front end because it's going to store the size and bytes so I'm gonna format that to kilobytes for this example and I'm only going to show that on the detail screen and then one cool thing about or one cool thing that I'd like to do in this fields method because if you have a lot of fields it can get a little bit just kind of bloated is I'll just extract a field out into a method so here I'm just saying photo field which is just a method that returns a field and in this case it's a file field and I'm going to tell it which disc I want to store it on using the storage system until I want to store the original name and the original size which both of these methods are optional I wouldn't have to do either of those things the creation rules the update rules and prune Abul which I'll talk about in just a second all right so if we look at this photo resource coming here to create a photo we'll just give it a name I have a little file here on my desktop just a little drawing at me create the photo and we've created the photo and you can see my size and the original name but you can see the photo just shows the name of the file by default and that's because I'm using the file you'll type let's go ahead and switch that to an image since we intend to store images here now we're going to get a nice preview of the image that's in our system and of course we can download it here now to edit the photo of course we're going to City to edit if we don't change the photo it knows just to use the same photo so we don't have to worry about that if we edit the photo and the field is notable let's say we can say we want to remove this photo entirely update now it's just kind of null in the database there's no photo I'm attached to this resource I'll go ahead and reattach it here alright and now by default this is all using sort of a convention of where and how to store things but you can override every aspect of this file storage you can override how it's stored you can override how this thumbnail URL is generated you can over at how the files are deleted that way if you're using a different sort of file storage thing like maybe a media library you can call that from within these hooks so I want to show you what that looks like so right now this is just sort of what it looks like with a default behavior so let me show you the equivalent if you were to override the storage and deletion so I'm gonna go into my snippets here give this custom store and delete I'm gonna just put that in place of this so this is doing the exact same thing but I just wanted to show you the override hooks so here I'm calling this store method which I just give it a closure which is going to receive the requests and this responsible for storing the photo in this case have extracted that out into a method called store photo which is just going to return an array and this array is corresponds to what we want to store in the columns in the database so I'm saying I want to store photo as this value original name is this value size is this value so I can update multiple columns at once when I store this delete I'm passing a closure and this is responsible for deleting it so I'm saying if we have a photo just delete it off the disk and go out these fields in the database so if I run this code and make sure this facades in there if I run this code it should be the exact same behavior that we were seeing before so I can delete it update and we'll reattach it here and it works the exact same as you would expect so I wanted you to be able to hook into all of that now another cool thing you can do is again this is an area that could get kind of messy like if you had these big closures with file storage logic so I actually had this delete photo in vocable class that has that delete logic in it and what I can do is instead of passing a closure let's just say new delete photo now if I edit this delete it update it's deleted so this is a common theme throughout Nova I could pass an in vocal object to the store method to the delete method to the thumbnail generation method and it lets you build really clean classes without bulking up this whole resource if that makes sense it's a pretty cool [Applause] now let's me make sure my storage directory is all cleared out okay so we only have the one file so since we mark this as printable what this means is hopefully if I delete this resource the file the underlying file in the storage system will also be deleted all right so it looks like I still have one file from earlier testing so let's go ahead and attach one and if we go to jump into sublime now we have the two photos out there so when I delete this photo I should see one of them disappear so I'm gonna hop in here delete this resource and we only have one file left on the file system so that it just cleans up your files for you if you or whoever's using the admin system is deleting records that have attached files they're automatically getting pruned out of your storage system that's just another feature we wanted to add so that you know Nova works in this really intuitive and convenient way all right so I'm gonna switch back to the master branch now I showed you the file uploads all right let's hop back into the user index and I want to take a closer look at that belongs to field on the post that I was showing you earlier so if you remember when I was creating a post I got this drop down of the available users and that's great because we only have one two three six users in this drop-down what if we had you know 5,000 users and this drop down so let's go ahead and put 5,000 users in the system all right so I'm gonna go to my database cedar then jump down here to the bottom to uncomment this line right here factory user 5,000 create alright let's go ahead and run this this em FS alias I'm using as my great fresh seed it's just a little shortcut I'm doing alright so now let's go to that user index and see how 5,000 users so of course I can still search on this and do whatever I want but if we go to the posts and create a post now for one this takes a second to load but this isn't very convenient you know feels like admins could better than this but a lot of times this is what you get you know if you're installing an admin panel we wanted to really thinks think think things through so let's go into our Nova post resource and let's try to clean this up a little bit and let's do that by just saying searchable all right let's search for Taylor all right and I can make my post publish it it's really great so no more scrolling through you know maybe even more users maybe ten thousand users just get fast search alright and now this is doing how is this search working how is the search on the index working working how's the search in that drop-down working and right now it's working like this ANOVA user I have this little array called a search you know and I'm just saying ID name and email and these are the columns I want to search but if you're familiar with the laravel ecosystem you know we have a really good search package called laravel scout so what if all my data is in algo Lea or some other search system that's supported by laravel Scout nope we can take advantage of that too so let's check that out I'm gonna go to my user model here should I mark that as searchable this is a Scout trait I'm gonna go to artisan Scout flush happy user I'm gonna make sure I don't have anything out there talk to outgoing and they gave me a API key with unlimited operations so hopefully we're good to go here you can import all those 5,000 users into my our goalie index now I don't have to do anything else in Nova it says when it sees a user model marked as searchable with the Scout trait it says okay we'll just use Scout for searching if I search it's using Scout knowledge going all the way out disk or algo leus servers and what's great is say I make a typo on this name see I still get the result whereas if that was not searchable in our Golia that's not gonna happen you don't get that nice fuzzy search so no but can hook right into the power of cloud search pretty seamlessly just by marking that as searchable it's really nice I can take that off there and that carries over even to the post you know if I'm creating a post tailor that's a scout search there I am alright so whatever data is in Scout like in this example probably it's searching every field the name the email probably even the passwords I didn't configure that goli index it's gonna use what however Algol is configured so it just works alright now I'm gonna get back to a more sane user account for this demo here alright back to my users and I'm gonna turn off algo Leah because this Wi-Fi the latency is a little bit bad but alright so now we're back to this our typical my sequel search now one thing I've been hiding from the Nova dashboard this far something that's really cool so let me hop into the base resource class from my application and I've been overriding this globally searchable property if I reload this hit slash on the index I get a search across all my now this is searching across everything I can just arrow down hit enter and I'm right on that resource it's really fast I can even display subtext so this posts in this case I'm on every post query we sure what that looks like on the back end by going to nova post there's a width property we're saying I want you to eager load the users so that means that on my subtitle I can access that user information to put it right there in the search results well then if I search for that I see the post and also who authored it let me quickly jump into that and know a little bit more about it what do you think about the global search hey pretty fast and of course I was opting out of global search for all resources but if you have some research that just don't make sense for global search you could just turn though just those off for global search and include only the resources that make sense for your application all right so that's another look at the belongs to field let me show you another field called the place field alright I'm going to clear that out what's this branch called user address now receive my database here alright now I've added a few more fields in this branch to the user resource so if I jump down here you can see I've got this this address fields method that I've extracted out and I'm using the dis merge method now these methods may look familiar because if you've used eloquent API resources all of the same methods like merge merge when when are all available to you so I've extracted this out and say I want to merge this into the original fields array then I can extract like a group of fields into the other method and keep my class nice and clean so in this case I've added you know there's a typical address set of columns into my database address address line 1 or address line 2 and blah blah blah city state whatever alright and I'm hiding all those from the index because I don't really need them on the main index so if I jump in for example my user here right now they're all null so if I edit them let's go ahead and fill this out this is my you know my childhood address that I grew up at Hot Springs Arkansas 7 101 901 and that's in the United States and we can update it so whatever it is simple text fields now what's really cool they'll be faster just to run this command let me just blow that data out let's come back into there and let's switch this to a place let's edit this and check this out what's cool about this is you don't need any Algol II account to use this you don't need to pay anything to use this you can use this for free with Nova right out of the box the first day without doing anything else and I think it supports 30 operations per second or something like that from your side so I mean you have plenty of room to use it and it fills in all those other fields and you can customize this field a little bit where you can control which countries is searching and so if you only want to search in the US address if that makes sense for your business you can specify that if you only want to search in some you know a European country you can specify that if you only want to search for a city you don't want to show street addresses at all you can also do that so it's really great really fast for working with addresses all right so that's a look at some of the other more interesting field types in Nova so let's jump back into relationships a little bit I'm gonna swap back out to the master branch yeah refresh here and let's look at many to many relationships because so far we've only looked at has minion belongs to we haven't seen anything else so in this application I've got our roles and users and that's a mini to mini relationship so it's a belongs to mini in eloquent and in this case my pivot table on this relationship for my intermediate table has an extra column notes right here sorry that's kind of small so notebook can handle that really well so if I look at this resource definition go to the roles field I say belongs to many roles and I can call the fields right here pass it a close or turn a whole nother set of fields for that pivot table so that means when I go to a user I'll say let's go to my detail page let's go down to rows let's hit attach role alright I can choose my roles and update my notes attached now if I go down here to roles I see that pivot table data right there so it makes it really easy to work with those situations but I look at my database it's right there in the pivot all right so of course I can update this and since this is a mini to mini when I click update here we're not going to update the role we're gonna update the pivot table so I can update those notes right there and updates the pivot table information in the same way if I hit delete here it says you want to detach this resource we're not deleting the role this is a minute of mini if we wanted to do that we would just go to that role and hit delete but since we're on the user detail viewing the roles relationship we can detach that and the role is still there the role hasn't been deleted we're just attaching it from that user all right let's see here so polymorphic relationships I to demo polymorphic relationships I have comments which can belong to either videos or can belong to posts all right so if I go to create a comment first let's do my user which is still searchable all right so we did that and now since this is a morphable relationship I have to pick what do I want what type of morphable entity am i creating this for so a poster a video so I'm gonna select video a search star for Star Trek there's my video my comment and we create the comment and now in the detail screen we have a nice display if the user belongs to the video it belongs to we can jump into any of those see the comment just like that see the content comment it's really great now it's also cools remember that posts were soft deleting so let's go back to comment create comment now in the previous example I did video but if I do post it knows that that soft deleting says do I want to include the trash results right here so I don't think we have any trash but if I click this now it's going to show me the trash results when I search so note was really intelligent about the state of your application so it knows to prompt you for things like that and that way if you want to attach a comment to something that's already been trashed or soft lead in the database you can do so really easily alright so I'm gonna select that post there and we could create a comment for a post alright if we're on the comments index on the comment Abul which is our kind of polymorphic field we see that this one's attached to a post this one's attached to a video we're gonna jump right in to whatever it belongs to all right so full support for every type of relationship [Applause] now what's really cool is I want to show you something in this video resource so you can see I had the movie poster here for Star Trek 2 but which really need a sets not stored in my database at all and this is a cool feature where I can show you kind of the flexibility that Nova has so I jump into that in this case I'm using an avatar field and an avatar field is that's what determines what's shown in the search results so when I search for users you've seen that little avatar of the person's head or you've seen the movie poster if a resource has an avatar field that's what's used in the search results so in this case I have an avatar field and I'm overriding the thumbnail method with an invoke ABAB jekt called retrieve movie poster and if we look at that all it's doing is making an API call to this movie API getting the post URL and returning it and I'm just caching that forever using the laravel cache system and I'm since they don't show that on forums so I can leverage this field and override that thumbnail method to display an image that's not stored in my application at all so what that allows me to do is if I create a new video say for Jaws just gonna pull that poster straight from the API it's really cool so I'll just update that to wallstreet let's say we get that movie poster it's really nice so this is that's just a small example of kind of how you can create it with these fields and do some pretty cool stuff all right and we can see that on the index alright so now let's go back to the index and kind of look at something totally new here all right so we've seen over here I've showed this a little bit with the soft deleting stuff and of course you can control how many resources are shown per page well we can also add our own filters right into this drop-down alright so we've seen previously when we've kind of dug into these users I have this active field for boolean just true or false and I can edit that will make Samantha inactive here and then it just shows false they're on active and so I've got a little filter to find here to filter by active or inactive and if we look at my Nova folder I've got a filter I'm just calling an active users now I need to attach that to a resource so if I go into my Nova user it has a filters method right here I'm just gonna return the filters that I want to be available on this resource so in this case I'm gonna say active users since I'm doing up an object I can pass it anything it needs for this request alright so I'm going to refresh this and now we get this nice filter added in here where I can show only active users only inactive or you know the default State so only inactive users right now is just Samantha so what's that look like behind the scenes so this filter class it's really simple it just has an apply method that receives the request to query and a value and you define the options that are in that little filter drop-down so only active or only inactive and it's gonna pass me this this little slug here all right so in this case I'm just gonna say think of these as sort of a UI for eloquent scopes so I'm saying query where active value equals equals only active so if it's only active it's going to say query where activists true otherwise it's going to be where active false all right so it's really simple you just modify the query however you need to and return it and then this shows up right there [Applause] now what's really cool is let's go back to roles admin let's attach the user and attach to users here see I'll touch Sophia and I could have hit attach and attach another there couldn't I and I'll put Samantha on there since she's inactive of course when I hit this button I'll be prompted to attach another one alright so there's our two users now even though I'm on the roll detail page that filter is still available to me even here and it's already scoped to this role so I can see only active only inactive so that all carries over onto this screen as well it's not just on the user index the primary index alright and so it also applies like say when I'm searching so if I hit only active and I try to search for Samantha I get I don't get anything whereas if I switch this to only inactive course I do get a results so if I have a filter set I can then search within that filter and it will automatically be applied alright so we have a CLI generator of course for generating filters I can just generate them with artisan Nova filter and then the name of the filter that I want to make and it will stub out that class for you all right so that's filters lenses lenses are similar to filters but let you take a more radical way of looking at a resource so in this application let's pretend I sell licenses to some software so each license belongs to a user and has some price that's just randomly generated and so it has many belongs to a relationship and let's say I want to create something because maybe the boss or whatever wants to look at the most valuable users in the system that have generated the most revenue for our application I can make it lens for that all right so I have a lens called most valuable users and this is a more radical modification of the query so I get the query and in this case I'm selecting several columns I'm doing a group by on this some of the revenue joining to the licences table ordering by the revenue and descending order I have full control over this eloquent query and I'm saying I also want to know what to apply any ordering they set on the query and any filters automatically so I can set a filter on this lens as well and nova will automatically apply it to it alright and now a filter doesn't define fields of course because it's just operating on the default index but with a lens you can define your own fields that are specific to this lens so in this case when I'm viewing this view of the reach of the users I just want to see the ID the name in the revenue I don't care about anything else and I'm passing a closure that can format that revenue with a dollar sign and you know decimal points and all that however you need to format it so let's attach that to the user all right so I'm just gonna leave that filter on there alright so we can say new lenses most valuable users now we get a new menu right here called lens I can jump right to most valuable users and see a new view of my users right here it's a really great way to build specialized tailored views with certain resources all right and so if I jump back to this lens you can see I've also attached a filter to the lens and I was reusing that active users filter that we had previously so right here I still have that filter leveraging that same code we already wrote and it's a only in active users and they're Samantha's revenue there or I could jump to only active users and see only the active users total lifetime revenue so it's really great to reuse those filters even in your lenses and of course you could see in my backing code previously that all I had to do to get that is to say request with filters and Melvin knows to modify that query with my filters it's really great all right let's see of course we're back in CLI generators Nova lens - generator lens all right so let's look at a another aspect of Nova which is actions now so far we're just seeing kind of create read update and delete but you can also attach actions to resources which are sort of like little classes where you can do whatever you want to either a single resource or a whole batch of resources so in this case I've got an action that's called deactivate and all this does is it receives some action fields and a collection of models and it's your responsibility to do whatever you want to those models it doesn't matter if the actions being performed on a single resource or on one hundred resources you always get a collection of models and in this case I'm just going to spin through the models and set the active property to false and then I'm gonna say Marcus finished which has belonged to the route action class which we'll talk about in a second all right now actions will have fields I have my other action I have fields which I'll show you in a second but let's attach this to the user new actions deactivate all right and now I'll select Samantha and TJ and now we get this little drop-down right here we can say deactivate run that action and they're deactivated you can see that TJ is now inactive all right you do whatever you want in these actions it's a great way to sort of build you know maybe you have a building system with users and you want like a refund charge action which may be on your user resource you have a list of payments and you can just hit refunds and payments and run that action and it calls some stripe API to refund the charge whatever you want to do you can build into actions [Applause] and of course we can run actions from the detail page as well so if I'm doing a single user and I have actions on that resource I can get that menu right there and run that against that user as well and now that's inactive all right so let's come pin to roles admin so here also I can select all matching and run actions from here as well this is a good example of say like let's use forge for an example because we're not building Nova I used how would I want Nova on forge because I'm gonna use Nova on force the first day Nova comes out but you know what would I want to do what would make sense and so say I'm jumping into a server and I want to run an action on all of that server sites so in this case this is kind of an example of that I'm jumping into a role I want to select all the matching users for this role and I can run an action on all of those users right there and it's done so it's really easy to kind of scope your actions using these detail screens and of course we could have done that easily using a search select all matching run the actions for everything that matches that search even if it's not currently on the page that I'm viewing all right now if something you're doing is destructive it doesn't that's not really communicated with this nice little blue button here so what I can do is go into that deactivate action and I'm just gonna say this is a destructive action and all that does is just kind of changed that URI to be red make it a little more obvious all right and we have see a lot generators for actions as well of course now what if we have an action that that takes a while maybe it takes a few minutes how can we handle that with Nova it's actually really easy let's just jump into this in action class let's just say should queue all right and I'm using the database cue driver so what I'm going to do is just go ahead and start up a worker here all right and Sue artists and cue work anytime I do queues live on stage I get the heebie-jeebies with it all right so I've marked that it should queue I've got a key worker running you know what let's go ahead and go into that action let's put a little sleep in there just so we can kind of get something real all right so we're gonna have that sleep for five seconds I'll restart that worker all right so let's go to Mohammed here hit deactivate which he really is deactivated right now since he broke his arm we wish you a speedy recovery Mohammed he does so much for laravel and has made some awesome forged features so round of applause from the hobbit and if we hit this run that action its processing that and here it is sleeping it's running in the background even though our UI refreshed immediately alright so now that's processed and you see he was still active when this refreshed because it was still happening I'm still in the queue but now if we refresh this is false so that sort of creates this problem of how do we know when these actions are done we never had any indication that the action was even running so let's fix that let's go into the user model let's mark that as actionable let's refresh this now I've got a nice audit trail of every action that's happened to Nova on this resource who's initiated by and when it happens all right so let's run let's run this again because it doesn't matter that he's already deactivated let's run that see that's running there let's go ahead and sit on this for a second now it's finished we can jump into that action and see what it was who initiated what the target was in this case it was Muhammad when it finished or if it's finished or whatever his status is and when it happened in my time zone so it makes sense to me it's really nice all right and even if I just update Muhammad just update that name I'm gonna see that too just like a regular action alright so cute actions really nice way to offload that background work just like you would in a typical laravel front end all right so what about what about pivot actions what if we need to run some actions on a intermediate table record so in this case you know we had our users and roles I've still got this here now of course roles doesn't have any actions right now we don't see anything let's jump in to I'm gonna look at that from this direction since I already have an action on users it will help it make more sense let's jump into that user I'm in the model roles field and what we can do actions I'm going to touch an action to that belongs to many relationship and in this case I would define it on both sides right I wanted to find out on the user side and on the role side because I want I want the action from both sides because if I'm always seeing that same pivot row so I've extracted this action definition into a little and vocable again just so I can share that across those two resources so in this case I have an action called update notes which is just going to date that notes field on the pivot table and to do that I need a field on the action and so every action has a fields method just like a resource or I can use any of the field types available ANOVA if I want to stick a big code block in the middle of a pivot table action that's fine I want to put a file upload in the middle of a pivot table action that's fine in this case I'm just going to put a notes field and make it required and then back here I'm gonna say user role actions I'm going to come over to the role side user field I'm going to do the same thing here so they share that definition does that make sense alright so now let's take a look at this you make sure that's the right namespace alright so if I select this now I get more options I can say I can either deactivate on the user resource itself or it says hey you also have a pivot action available since you're viewing the users from a role where you can update the pivot notes so let's run that and this time it prompts us for the notes because this action had fields on it so in this case this should update the notes for both of these users Wow okay and those are updating all right in that case that action received a collection of pivot models which as of laravel 5.6 or just regular eloquent models they just extend the model class just like any other model so you can do whatever you want with those all right see and also real quick before I move on you see how to pivot right here in this drop-down well there actually is a helper where I can call this refer to pivot as method and I don't know what you would call this but like roll assignment let's say you know just to give it like a better name than pivot something that makes sense go to the roll put it there too and now instead of pivot I should see role assignment so that just lets me know that that's happening on that role assignment record [Applause] alright so that is pivot actions in action fields so yeah that's actions let's move on to another feature of Nova all right I'm gonna receive my database because I can never remember like what I've actually done here let's look at another feature and that's metrics laravel has three types are Nova has three types of metrics we can show here on the dashboard so first let me show you a value metric and to do that I'm going to create more users again alright in this case I'm just gonna create 500 users and they're created at timestamp as being randomized so if I go to for example my user factory created at is now sub days or random in between 1 and 180 so these 500 users are going to be created all over the place over the last 180 days alright so let's go ahead and run that now I've got 500 users I should be created it you know random times alright so let's go ahead and generate something and maybe I want a view the total users in the application and I want to see how many new year's total users let's say for the quarter today and how that compares to my total users for the last quarter today that makes sense so to the prior quarter up until the current date alright so I can tell you firsthand that's actually pretty gnarly too right let's just do it live I don't have this pre coded say it artisan Nova trend artisan Nova value this is a value metrics it's really showing a single value let's call it a pic total users a pretty good name for this alright let's jump into that class generated I put it in Nova metrics when jumped on here and it says calculate and I've got this helper called count let's just tell it what model we're trying to network with here it prefilled these ranges so over the last 30 days 60 days 365 days month to date quarter to date year to date let's see what that gives us now it's only taken me like a few seconds to do this let's attach it here and the user resource we have a cards field we're gonna college I call it total users or new users total users so we have 78 total users so over the last 30 days I've had 78 users and that's an eight point three three percent increase over the previous 30 days it also go quarter to date I've had 70 quarter today which is a 2.78 present decrease over the last quarter today month today and quarter today in this case are probably the same because this is the first month of the quarter the month today is a little bit different because month to date and quarter today are not quite the same so month the dates a little different and then year today it says since they were all created this year we have no prior data on that so when you see our total users are 506 for the year all right does that make sense over the last sixty days I had 150 years with a 15% decrease over the previous 60 days these calculations are pretty gnarly to write if you're trying to build this out and you don't definitely not something you want to do on every single admin dashboard you do so would save you a lot of time so let's look at another type of metric which is a trinda metric I want to say artisan Nova trend new users all right I'm going to generate that while I'm here let's go ahead and add it here new metrics new users jump into that class want to count by days for the user model new users by day right there [Applause] can see there it's right there how many on each day over the last 60 days this looks a little cramped so let's go ahead and go in here our 60 days looks a little better and what's also cool is if I come into that new users there's a few other little helpers I can do here I tell it to show the latest value this is kind of handy in some cases I can see that six were created today and then I have the chart down underneath where I can look back in time alright so when I go ahead and take off that wit okay so let's try it with license as a trend metric so there's some other cool stuff to see there all right so let's call this license revenue license revenue we don't have to count let's do a some buy days on license class import that and we need to give it a call on which is price I want to see the sum of the licenses sold per day over time let's go to that license cards field new metrics license revenue so there that is now it's just giving us that five hundred and seventy which we know is dollars just offhand let's go ahead and fix that let's say dollars so now we have dollars it says show latest value 499 licences dollars for the license of sold today that's open under window there and of course we can view back in time over the last 30 days or I don't even know if I have 60 days worth yeah so it's really easy to view you don't have to just count you can sum you can average you can min you can max on these trends and even on the values that were showing you earlier all right so what's also cool is we can cache that so say this this one in particular doesn't take very long I'll just put a sleep in here so now it takes a little bit longer we get the nice loading state but let's go down here there's a cache floor method I want to cache that metric for five minutes all right so it's going to take a little while now it's real quick and easily catch those metrics alright let's go back to users and let's make the last kind of metric which is a partition metric I'm gonna call that active users I guess go to my users active users I think I had a little snippet for this one real quick yeah gonna grab that in this case it's wrong field around class metrics going to calculate in this case I need to give it a going to account in this case I'm just going to show a pie chart of who's active who's inactive so I'm going to say count the users by the active column and then I'm going to format that label because in the database that's just like a int 0 or 1 so I'm going to call this label method and give it a closure that can inspect that label and format into a more kind of user friendly way of looking at it go ahead and make sure this is imported and I want to see here now we get a nice pie chart whose accurate all right so I'm a little bit over time but I have more to show if you want me to keep going okay so one thing we haven't talked about at all and I'm gonna make it rid of some of this too so I have a little bit of a simpler interface to work with again I'm just gonna blow this all the way for now I think to get back to this one thing we haven't talked about at all is author ization so in some applications of course you might be the only one using this maybe you're building some sass you just need a quick admin panel for you to log into and run some actions on some data or look at some relationships or whatever update some data and you want to be able to do everything which is kind of how we've been using Novus so far but you don't have to use Nova that way like if you're letting a client log into Nova maybe you don't want them to be able to force delete certain resources maybe you don't want them to be able to edit certain resources nobody makes it really easy to have granular control over basically every operation and how it works is it uses Larry Bell's existing policies so you don't have to learn anything new no new authorization system to learn and how this works is if your model in this case if my user model my eloquent model has an Associated policy in this case I do have a user policy and right now everything is just returning true all the way down Nova will automatically use this so I'm on this user index if I come into for example my update method or my user policy and I say I only want to be able to update ID six user let's just say now of course I can update Samantha but I can't update any other users [Applause] if I go here and try to you know switch the URL 403 and you can customize that but I think it looks pretty sweet I wouldn't change it same way with 404 lost in space alright so we have full control over that same way no if I say delete maybe I don't want to be able to delete this resource I don't have any little trash cans anymore I can only view and edit I can't delete all right and I don't even get checkboxes to delete anything here if I'm viewing the user detail of course I don't have the Delete icon here either alright so let's go ahead make some deletable let's say we can update or we can delete only model ID 6 for the user so in this case samantha has the Delete icon and none of the other users do and if we come in here and we try to select multiple users and hit delete selected it's not going to delete TJ it knows you're not authorized to do that on the back end it only deleted Samantha so the authorization carries over there as well alright let's go ahead and just make it delete everyone again and see what else can we do here so that's you know update and delete we can also do you know viewing viewing any of a resource entirely so I have a post policy view any are gonna set that to false and now as far as this users concerned posts don't even exist in this system at all so I have a whole resource that I'm hiding for this user can only show for certain users that are logged in really easily alright so what about relationships I mean this is where most admins stop you know create read update delete you know true or false but apps are a little more complicated than that and sometimes I may have for example a post that I can't attach or add comments to but I can for other posts and this is also really easy to do so if I come here in here to posts let's go to my post policy I have a method called add comment this is a convention so anything add model name is a convention for controlling whether the user can add that type of model to this post or whatever resource I'm dealing with all right so if I return false here I can never attach comments to any post so I have no create button here at all I can just view them but maybe I can do it for some posts so the post ID is 50 I can add comments so now I get to create comment button and I can go in there and do that right there this is the morph to show the morph to type and worth to entity already set since I went straight through the detail screen I want to do search for my user and make my comment same way with many to many relationships maybe I can't attach certain roles to users or or whatever I can go into my user policy since this is a minidom inning I say attach role or attach whatever model you're dealing with in this case I can return false if I drill into a user here let me show you this so a while I'm on this detail screen I still have the attach that's because I was passing a particular role instance into attach so I have to say true or false cannot attach this particular role right here now there may be some situations where you don't want to touch any role so there's a convention for that attach any model name false now I don't even get that attachment at all because I I can't attach any roles at all all right but if that's true and maybe I can only attach the role ID one or whatever other you know more realistic check you would have in here and come in here to roles I can only attach will have two roles in the system administrator and editor but I'm only saying administrator because that's the only role I'm allowed to attach but I can attach it just like that so just those conventions just create update delete and then the ad model and attach model gives you full control over every operation and Nova as far as the crud goes in authorization so you have really fine grained control over attaching adding updating all of that just using Polly's policy it's just using simple PHP code that you used to all right that don't make sense okay [Applause] alright now let's think about actions again for a second all right so let's attach this action that deactivate action I had let's put it back on the user action is deactivate all right now I can select a user and run this action now what if I want to authorize who can do that when I create this action on the user let's see if they can see this action just like that now I'm gonna say this one it's always return false to hide this action it's not there anymore they're not going to enable it again just like that now it's back now there may be some situations where I can run this actions for certain users but not for others so in that case I need actually two methods so I can see it sure what can I run it maybe only if I think it passes me the user here maybe only if the ID is 6 hopefully I didn't mess this up sorry you're not authorized to perform this action [Applause] when the idea 6r ran successfully all right so we have full authorization over actions now we can also hide and show certain fields so we've been showing the email field I can come up here into my fields just like we did on actions I can do can we see this field may be false now it's not there anymore so it's really easy to hide certain fields there's another way to hide fields which is just this wind false so you don't need any call back at all that would also hide the field so you could have some conditional here based on their request you know if request user can whatever some check then you could show that field then it's there all right [Applause] so now what about the index if I want to scope what the user can see on a given index what I can do is I can override certain methods of the resource so if I go into the post resource let's go down here to this index query method and right here I can scope that index query for every time that index is loaded so in this case maybe when this user is logged in I only want to show the posts that belong to that user on the index say right here where user ID user ID now I only see my posts when I click post here so it's really easy to limit what a given user can see and that's kind of related to the authorization system so it's really easy to fine-tune and I can override the index I can override what's shown in the relationship search and I can even override Scout queries as well all right hopefully that made sense but we try to make the authorization really powerful but really simple to use and still give you cover all the bases for what you would want to authorize all right so to wrap up this is a good putt just a couple more things and for that I'm going to switch to a different repository that has some other stuff here called Larrick on nova custom now so far we're just seeing kind of built in Nova stuff but what if you want to add your own stuff to Nova go to a different site here login to my Nova dashboard which you can control what that path is for you and in this case I want to show you four things custom tools custom resource tools custom fields and custom cards so let's start with custom tools so what if I want to put a new tool on the sidebar right here and build some entirely new component in Nova say for example like a media manager which I haven't built yet I'm just saying this is an example that hopefully someone in the community can build though so what it looks like is and jump back here for a second and we have a CLI called Nova tool and let's say it's called OTT well mediamanager kind of looks like a composer thing and ask you do you want to install the NPM dependencies the tools assets and then update your composer packages what it's actually doing has a creationist directory called Nova components and it makes a media manager directory and if I look at that it's going to create a tool dot view and media manager and this is a single file component that you have total control over you can customize how it looks you have scope styles you can make Ajax calls to custom controllers you have full control over what this component looks like and when you're ready you can just go to your Nova service provider down to your tools method let's just return that as a tool and there it is in the sidebar and what's great is really how much you can do when we just give you a view component and say here you go take it from here you can make it look however you want you can make it make whatever back-end calls you want you can style it however you want it's really flexible anything you can do in a view component with some laravel back and you can do in Nova and integrate it right in as a tool that you either keep private to your company of course or ship on the github and which other people can install as a composer package and just return it from their tools method and their Nova service provider so I'm really looking forward to seeing what you build with that and what's cool is if I jump into that media manager can just do something like yarn run watch here start watching that now if I come back into that tool view I can update this file and it recompiles and I'm ready to go so I can just work on it really quickly using laravel mix alright so that's custom tools now there's also a custom resource tools so a good example of this might be say you have users and like I mentioned before you're using stripe and maybe you want to build a custom resource tool that lists all the striped charges for that user maybe it hits the stripe API behind the scenes and return some stuff and then you show it on the front end so that's something you would not show the sidebar that's something you want to show just on a user's detail screen so in this case I have in Nova components a stripe inspector just stubbed out I don't have an actual back-end in place but what we can do is go to like Nova user go down here to fields down here at the bottom and uncomment I just returned it like a field stripe inspector make and in this case I'm calling this method and this method is dynamic and what it will do is pass down this value to the view component so the view component is going to receive that in its field prop that it receives I can just say field dot show refunds and it'll be true or false so it's really easy to pass stuff down into your view component and then use that on the client side all right so what that looks like so I jump into it user detail down here at the bottom I get a stripe inspector and since I'm passing true on the client side it's saying we're showing refunds if I pass false that will be passed down to the class side as well not showing refunds and similar to sidebar tools what this actually looks like is it's just a view component so in resources j/s components I have a tool dot view I'm receiving the field so I can access that data that I pass from the back in and show whatever I want I can make any Ajax calls I want and I can have any scope styles I want and I can make this component look however I need it to look and make whatever back in calls I need to make we don't try to box you in we just sort of think of the view components as a canvas which you can do whatever you want on alright so those are resource tools so there's tools which live in the sidebar and resource tools which live on a resources detail page alright so there's also custom cards now cards metrics are cards so those little cards where I was showing the metrics the little panels that's what we call cards in a nova and I can make custom cards that I can actually put right on the dashboard so in this case I actually do have one fully coded out which David Hemphill built for me which is a Bitcoin price tracker just to give an example of what you could do and just like you might expect in components I have a card view where I can do whatever I want in this case I'm making some Ajax calls to an API on coin desk showing some data displaying it using tailwind and now if I go into my Nova service provider cards this help card that's what you're seeing when I go to the dashboard and you're seeing those kind of links into the documentation that's just what we shipped to kind of stub out that dashboard I can remove that new Bitcoin price and port it now we get that card right there on our dashboard with the current Bitcoin price so you can but whatever custom cards you want anything you can do in a view component you can build right into your Nova dashboard alright [Applause] [Applause] and now finally the last feature I wanted to show you is custom fields so you're you may run into fields that you need that aren't built into Nova for example you know the markdown and the tricks that was all built in but what if you have something that's not built in you're not just stuck you can create a custom field so in this case I'm just doing a color picker just a really simple one and now whereas tools and cards and resource tools just had a single view component a field actually has three so if I go into resources Jas components I have one for the detail screen one for the index screen and one for the form screen on the detail screen we have this panel item component which just gives you kind of the default detail screen display we have an index which I'm just showing as a span just to show the fields value and on the form I have the input width type color and we have some helpers called a form field and handles validation errors which makes it where you don't have to worry about displaying the validation errors as much it kind of gives you some helpers like has air first air stuff like that and what this looks like is we have a method for setting the initial value of the field and then when the form is actually being sent up to the server it passes us the form data so we can append whatever we need to we're going to put multiple things just because this is one field we could put three things into the form data going up to the server it doesn't really matter and then we can handle the value change however we want and so we would use this just how you might expect I just returned it just as a field and my my Nova resource in this case I'm gonna call it favorite color which I have in the database and I'm gonna hide it from the index all right so if I jump into a user dig in here and edit now I have this custom field color selector I can save that and it uses my detailed view here to show it right on the details so if you need a field you can generate it generate it using the CLI Nova field will generate all the stubs and view components you can ship it out on github if you want to share with everyone else and then you have a totally custom field that's extended what Nova can do out of the box the color picker also fields also shipped with a back in class this lets you control how the field is actually stored in the database once the server gets it so you can override a few methods like resolve and Phil where Phil will actually fill the model attribute with the value and resolve will resolve it out of the database and that lets you format it or do whatever you want to do but by default it sort of behaves as a text field would where it just sets the value just plops it into the model attribute and sits safe all right so that's custom fields okay so that's an overview of laravel Nova hopefully that feels like something that could be useful I know at least I'm going to use it the first day comes out [Applause] so I'm actually gonna go ahead and launch out the Nova site for y'all swap that to true and Ford should take care of auto deploying that out to production hopefully there we go so that's an introduction to Nova it's a I think a best-in-class administration panel know me and David and Steve we really tried to sweat the small details with this because there's a lot of products out there that feel like they're not all the way thought through or they're not they don't make sense for you know production applications so with me having fortune on four it sort of gave me something to dog food and say what makes sense of what doesn't make sense and where admin panels really not really fleshed out like the global search the authorization you know viewing the relationship from a detail screen off integrating with scalp all of that stuff that makes it really cool cute actions to really give you a quality product that's well tested on the back end hundreds of front-end tests hundreds of back-end test you can really depend on it and it's going to launch next month we're going to just if you sign up on this list we're going to kind of bleed out early access into Nova so you can get your hands on it and there's gonna be two it's going to be similar to spark where it's a similar license just ninety nine bucks for a solo developer that's anyone that's just hacking on something for themselves or anyone that's making less than twenty thousand a year on their business or $1.99 for commercial businesses that are doing you know prime if you're doing projects for clients and teams that's a commercial license so I hope you love it have a thousand laravel Nova stickers that we can distribute at the after party which are super rare and be sure to come eat and drink we can talk about Nova and check out the science experiments thanks [Applause]
Info
Channel: StreamACon Streaming Conferences
Views: 83,181
Rating: undefined out of 5
Keywords: Laravel, Nova, PHP, Conference
Id: pLcM3mpZSV0
Channel Id: undefined
Length: 92min 49sec (5569 seconds)
Published: Wed Jul 25 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.