If you are interested in creating a laravel app with a front end javascript library like React or Vuejs, these notes I am sharing will show you how to start a Laravel Project with Vue.JS.
My Development Environment:
List of Linux Terminal Commands in Chronological order:
$ curl -s "https://laravel.build/example-app" | bash
$ cd example-app
$ touch MyNotes.txt; code MyNotes.txt
$ sail up
$ sail composer require laravel/jetstream
$ sail artisan jetstream:install inertia
$ sail artisan migrate
$ npm run dev
Lets create a New Project called example-app
$ curl -s "https://laravel.build/example-app" | bash
$ cd example-app
Create a file for you to keep notes:
$ touch MyNotes.txt; code MyNotes.txt
Start the laravel app with sail
NOTE: I am using sail as the alias for ./vendor/sail$ sail up
I GOT AN ERROR: Creating example-app_mysql_1 ... error
SOLUTION - Kill all the docker containers: docker stop $(docker ps -a -q)$ sail up
Open this url with your browser: http://localhost/
Install JetStream$ sail composer require laravel/jetstream
Install Inertia$ sail artisan jetstream:install inertia
RESULT: INFO Inertia scaffolding installed successfully.
Run the data base migrations:$ sail artisan migrate
REFRESH BROWSER TO: http://localhost/
* YOU WILL NOTICE LOGIN AND REGISTER LINKS
CREATE AN ACCOUNT at http://localhost/register
name: John Doe
email: [email protected]
password: pass321!
TAKE A LOOK AT JETSTREAM Page, looks nice right!
Notice the PROFILE MANAGEMENT: http://localhost/user/profile
You can allow pictures in the user profiles. ENABLE PROFILE PICTURES:
open: jetstream.php$ code config/jetstream.php
REMOVE COMMENT FROM:
// Features::profilePhotos(),
REFRESH Browser to see the new upload picture feature: http://localhost/user/profile
Start the front-end server$ npm run dev
OUTPUT:
VITE v4.0.3 ready in 1592 ms
➜ Local: http://localhost:5174/
➜ Network: use --host to expose
➜ press h to show help
LARAVEL v9.45.1 plugin v0.7.3
➜ APP_URL: http://localhost
STOP SERVER AND NOW RUN IT ON SAIL:$ sail npm run dev
OUTPUT:
VITE v4.0.3 ready in 686 ms
➜ Local: http://localhost:5173/
➜ Network: http://172.22.0.7:5173/
➜ press h to show help
LARAVEL v9.45.1 plugin v0.7.3
➜ APP_URL: http://localhost
Lets see the Vue application in action, open Dashboard.vue$ code resources/js/Pages/Dashboard.vue
REPLACE: <Welcome />
WITH: <h1 class="text-xl font-bold p-4">Hello World</h1>
REFRESH: http://localhost/
Done:
Resources: