Skip to content

Instantly share code, notes, and snippets.

@jessekanner
Last active March 15, 2022 19:42
Show Gist options
  • Save jessekanner/6dc1f658d9a5d2a98b21c281011790c7 to your computer and use it in GitHub Desktop.
Save jessekanner/6dc1f658d9a5d2a98b21c281011790c7 to your computer and use it in GitHub Desktop.

source: https://medium.com/@jcandan/the-untold-path-to-laravel-on-lando-d633c9cb8e8a

$ lando init --recipe laravel --webroot public --name My\ Project
$ lando start
$ lando composer create-project --prefer-dist laravel/laravel my-project

We initiated our Lando configuration above the my-project directory, so let’s move .lando.yml into my-project/ and restart.

$ mv .lando.yml my-project/
$ cd my-project
$ lando restart

The last thing we need to do is to configure our environment settings. Laravel’s default configuration file specifies homestead as the database. We just need to edit the .env file with the following. Note these values can be seen via lando info.

# @file .env
APP_URL=http://myproject.lndo.site
DB_HOST=database
DB_DATABASE=laravel
DB_USERNAME=laravel
DB_PASSWORD=laravel

Then migrate the database schema.

$ lando artisan migrate

Log into virtual server and install Jetstream

lando ssh
composer require laravel/jetstream
php artisan jetstream:install livewire

Run NPM as requested (may need to be done from your command line, not the virtual one)

npm install && npm run dev

Then when you're ready to start writnig code, start Lando in normal fashion from your command line:

lando start

Keep a window up in the virtual server to run migrate commands

lando ssh
php artisan migrate
@brandonratz
Copy link

You can include the following to .lando.yml if you want Node as a service and use NPM accordingly

services:
  node:
    type: node:14
    globals:
      gulp-cli: "latest"

tooling:
  npm:
    service: node
lando npm install && lando npm run dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment