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, 45:12
3.Managing Pages6 lessons, 1:12:31
4.User Management2 lessons, 27:40
5.Managing the Blog3 lessons, 42:25
6.Adding Extras2 lessons, 25:48
7.Implementing the Front-End3 lessons, 32:10
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're 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 in 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 the 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 you, for your laravel development. The actual URL here really depends upon the version, of Laravel. The current version is 5.5, so this is laravel.com/docs/5.5/homestead. However, if you just do a search for laravel homestead, chances are very good that the first option is going to be for the latest version. Of course you can always go to the documentation, choose your version, and then you're good to go there. So just follow the instructions, and you'll be good to go as far as Homestead is concerned. Now 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 is 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 you 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 download and install Composer. It's 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 say composer global require and then we will 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 larvel/larvel 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 Larvel installed, I'm just going to say larvel 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 us so that we can change these important settings for whatever environments that we need. Now in our case we want to change the data base name. Our database is going to be called laracms, or you can 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 user name 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 schemer, and we're going to do that using migrations.