By the end of this video you will know how to install a Laravel web application with Laravel Jetstream, Vue and Inertia.js.
Steps
Installing the Laravel Installer
The first thing we need to do is install php if you do not have it running on your system. We then need to install the Laravel installer by running the following command in the root of our project: "composer global require laravel/installer". Once the Laravel installer has finished installing on your machine, you should be able to create a new project by running: "laravel new courses". You may encounter an error here. If you get the message "command not found: laravel" you will need to set your PATH. Instructions on how to do this can be found at https://ralphjsmit.com/fix-laravel-co.... Once you have set your PATH, close the terminal window, open it again and try running "laravel new courses" again. This should now start the Laravel application installation process.
Running the Laravel Installer
So you have now run "laravel new courses" to start creating your Laravel web application. We will now be presented with a series of questions which we can answer to configure our Laravel app. We need to select the following:
Laravel Jetstream for the starter kit
Vue with Inertia for the Jetstream stack
Email verification for optional features (these can be turned on or off later)
PHPUnit testing framework (we are not going over this in the course)
MySql for database
Select "No" when asked if you want to run database migrations (because our database does not yet exist)
Creating a Local Database
We now need to create our local database for our Laravel application. We do this in phpMyAdmin. To find phpMyAdmin - open MAMP and make sure the server is running by clicking "start". Now click on "web start". From the web start page find the mySql drop down and the link to phpMyAdmin. Now create a new database.
Connect to our Local Database
Open your newly created Laravel project in VS Code and find the .env file. In this file we need to put our database details in order to connect our Laravel application with our database. The details that need changing are as follows:
DB_DATABASE=name_of_database_you_just_created
DB_PORT=8889
DB_PASSWORD=root
Running db Migrations
Once you have made these changes to .env you are ready to run your migrations to create tables in your database. To do this, simply run "php artisan migrate" in the terminal.
Almost There
We now need to run "npm install" and then "npm run build". At this point your installation is complete. We are now able to server our application and view it in the browser. To do this, run "php artisan serve". Once this is running you will be able to view your Laravel application in your web browser at "localhost:8000".
Now we need to run one more command to ensure that any changes we make to our frontend files are automatically detected and reflected in our browser. This command is "npm run dev".
Table of contents
00:00 - Recap
00:33 - Requirements to install the Laravel installer
01:03 - Creating a directory for our Laravel project
02:17 - Installing the Laravel installer
03:05 - Attempting to create a new Laravel application
03:35 - Fixing "command not found: laravel" error
04:03 - Creating .zshrc file
05:23 - Checking the Laravel installer is working
05:35 - Creating our new Laravel application
05:46 - Selecting options for our Laravel application
08:38 - Creating a local database using phpMyAdmin
09:26 - Opening Laravel project in Visual Studio Code
10:12 - Adding database details to .env file
11:00 - Running database migrations
12:13 - Installing npm and creating our build files
12:41 - Serving our Laravel application
13:27 - Watch for changes with and automatically build files with Vite
Links
https://laravel.com/docs/11.x/install...
https://ralphjsmit.com/fix-laravel-co...