2.1 Creating the Project
Naturally, if you want to follow along with this course, you'll need to install a development environment. I'll show you how in this lesson, and then we can create our project!
1.Introduction1 lesson, 01:23
2.Getting Started4 lessons, 46:41
3.Managing Pages6 lessons, 1:12:31
4.User Management2 lessons, 27:37
5.Managing the Blog4 lessons, 41:51
6.Adding Extras2 lessons, 26:07
7.Implementing the Front-End3 lessons, 30:24
8.Homework Review1 lesson, 07:11
9.Conclusion1 lesson, 01:24
2.1 Creating the Project
Obviously, the very first thing that we need to do is create our project. But before we even do that, we need to talk about our environment because we can approach our environment in a variety of different ways. Now of course, you need PHP, you need some kind of database. And we are going to be using MySQL in this course. And you could also use an HTTP server. Now that latter thing isn't as crucial because we can use the server with PHP and Artisan, but we definitely need PHP. We also need a database. So you can install those things and configure them if that's what you want to do. But you can also use a tool that is going to give you everything that you need out of the box. One of those is called Homestead. This is a virtual machine, which is very nice because it keeps your development environment well isolated from everything else. If you are especially developing with multiple technologies on multiple different platforms, it is a really good idea to use a virtual machine. That way you can fire up whatever virtual machine you need for whatever technology or platform, and you're good to go. So Laravel is one of these solutions and it uses something called Vagrant. Now I'm not going to go over all of the installation steps required for setting up Homestead, but this is what I recommend for your Laravel development. So just follow the instructions and you will be good to go as far as Homestead is concerned. As far as my environment, I'm using something called MAMP. This is not a virtual machine. This is a tool that installs PHP, MySQL, Apache, and a variety of other things. Now the reason why I'm using MAMP is because what you see on screen here is a virtual machine. So, if Inception taught us anything, it's that we don't run a virtual machine inside of another virtual machine, if we want any type of performance. So that is why I'm using something other than Homestead. But I highly recommend that you use Homestead for your Laravel development. Okay, so we want to create a Laravel project, but in order to do that we need Laravel. So, we can get Laravel by using a tool called Composer. If you go to getcomposer.org, then this will take you of course to the website. \And this avatar will be different based upon whenever you load it. You can see that I'm just refreshing and it's going to look a little bit different, but that doesn't matter. What you want to do is download and install Composer. It is a very straightforward installation, and once you have it, then you are ready to start creating your Laravel project. So the first thing we need to do is install Laravel. And we can do that in a couple of different ways. The first thing we can do is run Composer. We'll say composer global require and then we'll say laravel/installer. This is going to install the installer for Laravel. This is going to cache everything so that we can just use the Laravel new command in order to create our project and everything is going to go from there. The other option is to simply use composer. You would say composer create-project and then you would say prefer-dist laravel/laravel, and then the name of your project. We're going to call this LaraCMS. So either way, you're going to end up with a project. Since I have Laravel installed, I'm just going to say laravel new LaraCMS, that's just a lot easier to type. After we create our project, we of course want to open it up in our code editor of choice, because we want to modify the .env file. This is a file that contains settings for our environment. This is a development environment. So all of the settings here are for our development environment. But whenever we decide to push it out into production, we could either change the settings inside of this .env file. Or we can have a completely separate file that contains all of our production environment settings. It makes it so that we can change these important settings for whatever environments that we need. Now in our case, we want to change the database name. Our database is going to be called laracms or you can call it whatever you want, it really doesn't matter. I'm just going to keep the name of the database the same as our project. And if you're using Homestead, then that's pretty much it. Since I'm not, there's a few other settings that I need to change. My port is 8889. My username is root and my password is root. But once you make the necessary changes for your environment, you are pretty much good to go. So that in the next lesson, we can get started creating our database schema. And we're going to do that using migrations.