Introduction to the TALL Stack Theme for Wave
Hey, what's going on everyone? In this video, I want to show you how you can install the tall stack theme with your Wave application. And if you're not familiar with the tall stack, you can go to tallstack.dev.
And the tall stack is Tailwind, Alpine, Laravel, and Livewire. And it just makes building applications so much fun and so much easier than before. So, I'm going to show you how you can easily install Wave and then how you can install the tall stack theme.
Downloading the Wave SaaS Starter Kit
So, if we go to github.com, actually I want to show you this real quick. If we go to the trending, this is super cool.
So, Wave has been trending for quite a while. You can see it's 265 stars right now, right below Dogecoin. So, that's kind of cool. So, we're at about 2100 stars and we've just been getting a lot of stars recently and that's super cool because it will help move this project along.
And I did recommend before cloning the repo into a new folder, but I'm going to actually suggest that you go to the tags and you can find the latest version. So, right now that is 2.0.1 and what we can do here is we can go ahead and just come down to the zip file and go ahead and just download that.
And now I'm going to open this up and I'm going to call this wave-tallstack.
And I'm going to move this into my sites folder.
Standard Wave Application Installation
Okay, and then I'm going to navigate to this in my terminal.
Going to go to CD sites and wave-tallstack.
So, to install Wave, we need to create a new database. So, I'm going to pop open TablePlus and go to my localhost and then say that I want to add a new database and I'm just going to call this wave-tallstack.
Okay, we've done that and I'm going to open this up in my code editor.
Okay, and then I need to go into the .env.example and copy this and create a new file and just call this .env. I'm then going to paste that in there and I'm going to change the URL to wave-tallstack. And we will change the database to wave-tallstack as well.
Then we need to install the composer dependencies, so we'll do composer install.
Next, we'll run PHP artisan migrate. And then PHP artisan DB seed. And again, all these instructions are in the GitHub repo. And just like that, we've installed a new copy of Wave.
Obtaining and Placing the Pro TALL Stack Theme
So, now if we were to go to wave-tallstack, we can see that we have our new application in front of us. And this is using the default Tailwind theme, which you can totally use. It basically has Tailwind. It does have some Alpine functionality, and then of course it uses Laravel. But if you want to add some Livewire magic in there, you will probably want to upgrade to a pro account, and you can gain access to the pro repo. So, if we go here and we go to pro support, you can see that if you upgrade to a DevDojo pro account, you will gain access to this new repo that we're going to have a bunch of new themes in there. And then you can also join in on the discussions. So, I'm going to go ahead and go to that repo right now.
And if I go here, I can go ahead and just download this pro repo.
And I'm going to open this up, and inside of here, we have a themes folder, and then we have the tall stack theme. So, I'm going to go to my sites, wave-tallstack, and this is inside of our resources views themes folder. So, you can see that we have the Tailwind theme. I can then move the tall stack theme into that folder.
And I probably will have a more streamlined way of installing new themes, and then we will even have like plugin support and a bunch of other cool stuff down the road. But for now, you just need to copy that folder into your themes folder, and we can jump over to the documentation.
Installing Theme Dependencies with NPM
So, if we go over to the documentation, we can then go to features, and go down to themes. And here it says, under the theme assets that we need to run NPM install inside of a new theme. So to install a new theme, we then need to CD into that folder.
And we'll install the node dependencies by running NPM install.
And after that's complete, we can then run our asset watcher by running NPM run watch.
Activating the Theme and Previewing Livewire
Okay, and the last thing that we need to do is we need to activate the theme. So let's go and log into our application and again our admin credentials is [email protected]. This is all in the documentation as well. And the password is simple enough, password.
So we can then log in and we can go to our admin. So we go up here and we go to the admin.
And then we'll go ahead and fix that. We can go over here to the left and click on themes. And I can see that we have the Tailwind theme and then we also have the Tall Stack theme. So let's go ahead and activate the theme.
And now let's go back to the main site and you can see that it looks very similar. So it is using pretty much the same theme, but it is using Livewire in the back end. And we can also create new Livewire components and do a bunch of awesome Livewire stuff to build our software as a service. So let's go ahead and test this out. If we go to our settings and let's go to the security, you can see that this is actually powered by Livewire. So I can enter in my current password. And then I'll enter in a password that does not match. And if I click on update, it's not going to do an actual server request. It just did a Livewire request and then printed out the error message.
Creating a New Livewire Component
Okay, so before closing out this video, how about we create a new Livewire component and then we add it to the main dashboard and maybe we kind of add like a task list or maybe like a task board. I'm not going to add a bunch of functionality into it, but I want to show you how you can create your own Livewire component and then add it directly into your dashboard. So, let's go ahead and create the component.
Okay, so if I CD into that folder, I can then run PHP artisan make Livewire and I'm going to call this component task list.
And it just created the class and the view for our new component. Okay, now that we have our component, maybe we also want to create a quick migration. So, I'm going to say PHP artisan make migration create tasks table.
And then finally, I'll probably need a model to go along with that. So, I'm going to say PHP artisan make model task.
Configuring and Running the Database Migration
Okay, so now let's go over to our migration and add a few columns.
Okay, so we already have the ID. Maybe we want to have a string which is the actual task itself. And then maybe we also want to have a boolean value that is completed and we'll say by default this is going to be a zero.
And finally, we'll say that we want to have an integer that is going to reference the user ID who created this task. And we'll set that to unsigned.
Okay, now that we have our migration, let's run PHP artisan migrate and if we open up the database and we take a look, we now have this tasks table.
Building the Livewire Component's Blade View
Okay, so let's work on our component a little bit. As you know, whenever you create a new Livewire component, you have the class created inside of your app HTTP Livewire and we have our task list class component. And then we also have inside of our resources views Livewire, we have our task list view.
Okay, so let's go ahead and just add a few classes here. We'll say that we want this to be width of full and I want to create a container where we're going to add a new task. So, I'm going to say class gives a full width. And actually want this to be a max width of we'll say 3XL. We want to center that. And we also want this to be flex.
And then I'll say I want this input of type text and I want to give it a placeholder. And I'll say add new task.
Now, we're going to say class of width full and form input.
Okay, so I'm going to save that and then I'm going to go to my dashboard view. So, I'm going to say dashboard /index and if I look inside of the tall stack theme, this is the file that we want to edit. So, I'm going to click on that and I'm going to add my livewire component here. So, I'll just say at livewire task list.
Wiring Up the Livewire Component Logic
Let's save that. Let's go back to our dashboard and see what we're dealing with here. Okay, so we now have this new input that says add new task. How about I add a button over here and to add a button, I'm actually going to copy some of the classes from our save button right here.
Yeah, let me just copy all these classes.
And let's jump back to the dashboard.
Okay, so now let's add the button.
So, I'm going to give this a class of all this stuff right here. I know that I have a margin top that I actually don't need.
And let's say that we want this to be flex item center and then we also want to give it a space of X 3. So, we want a little bit of space between our input and our button.
So, I know inside of our input, I want to actually model. So, I'm going to say wire model. And I want to model a public property called task. And this is going to be the new task that we're going to add to the database. I'm actually going to make this wire model.lazy cuz I don't want every single time that we type a new letter inside of the input, I don't want it to do the Ajax request. Okay, and then for our button, we'll say wire click equals and we want to call a method called add task.
Implementing the 'Add Task' Backend Method
Okay, so now we have all that in place. Let's jump over to our class. And we need to add our public task. And then we'll add this public function add task. And in here, we need to add our new task. So, when the user clicks on the add task button, we then need to create a new, say task equals new task. And I actually need to include this name space. I think this actually just got put inside of the app folder. Yeah, there's our app task.
So, I'll just say use app task.
Okay, so we'll say task. And ironically enough, that is just task task. I could have named that task name. That might have made a little bit more sense. But, we'll just go with this. And this is going to be this task. And then we'll say task user ID is going to be the current authenticated user ID. And we'll say task save. And then after we save, we want to clear out the input. So, we'll say this task equals empty string.
Let's go back and let's go ahead and possibly debug this. So, we actually don't even have any text inside of this button.
So, how about I add some text that says add new task. Okay, so let's save that, go back here, reload, and we can see that that button is actually collapsing the text. So, I can add a quick class here called flex shrink zero. So, I don't want this to collapse the text. And that looks a lot better. So, how about I'm going to add maybe a grocery list? So, I'll say milk, click on add task, say eggs, add task, and cheese, and add task. Now, let's look at our database. If I reload, we're going to see that we have each of those inside of the database. So, that's pretty cool. We just added some simple Ajax functionality with our Livewire component.
Displaying Tasks and Demonstrating Live Updates
Maybe the next step is I want to print out all of the tasks inside of our list.
So, I need to first create the relationship inside of our app user model. And I will say public function tasks. And the user has many tasks. So, I'll say return this has many. This is going to be app/task class.
Okay, and then inside of our task list, let's go ahead and display the current tasks that the user has added.
So, I'm going to wrap this inside of a width full. We'll say max-w 3XL, and we want to center this.
And now let's do a simple for each. We'll say for each user tasks. And did I pluralize that? Yeah, I did. So, I said tasks as task.
And let's go ahead and print this out. This will be task. Task. And maybe I want to add a div around this. So, I'll say div class equals full text SM.
And let's save this. Let's go back to our dashboard. Let's reload and now you can see that we have our tasks in front of us. So, let's go ahead and add a few more. So, I'll say orange juice.
And sure enough, that gets added. Awesome. Oh, yeah.
Conclusion and DevDojo Pro Overview
Okay, so that's pretty cool. We just went ahead and added a new Livewire component and we just added a few tasks and then you can see that it automatically live updates and that's just some of the awesomeness that you get with a Livewire and that you get with the Tall Stack theme in your Wave application.
So, that is it for this video. I have a lot of cool things planned for Wave and the Tall Stack theme is just one more addition that you will get if you upgrade to a pro account. So, make sure to check it out at devdojo.com/pro and with a pro account, you get a bunch of cool things including the Tailwind page creator and of course the software as a service starter kit. You can gain access to the premium videos and some premium themes and plugins down the road. Then you also have the Ninja training program. So, if you're not familiar with development at all, you can learn the basics like HTML, CSS, JavaScript, PHP and Laravel and then you can go into creating your software as a service with Wave. And then we also have some premium courses and episodes, of course some ebooks and you can also gain access to SaaS Adventure which is a 21-day program that will teach you how to create a software as a service from the ground up. So, really the idea behind this whole program is I want to teach you the skills to create your own software as a service and how all that functions underneath.
So, thanks again for checking out this video. Be sure to check out the pro account if you want to gain access to some premium Wave resources and I hope you guys have an awesome day and I will talk to you in a future video.