1. Install Homestead

Locally On A Mac

Replace all references to "survloop" with a short name for your own project.

  1. Install XCode from the App Store. Open it, and accept the user agreement.
  2. Install VirtualBox: https://www.virtualbox.org/wiki/Downloads
  3. Install Vagrant: https://www.vagrantup.com/downloads.html
  4. To the command line (Mac OS Terminal, or iTerm)! Create local ssh key, if you haven't on this computer before:
    $ ssh-keygen -t rsa -C "your@emailaddress.com"
  5. Install Composer, Homestead, and initialize. For this example, the work area's directory is "~/web", but you can adjust it as needed:
    $ vagrant box add laravel/homestead
    $ curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer $ cd ~/ $ git clone https://github.com/laravel/homestead.git homestead $ cd homestead
    $ git checkout release $ bash init.sh

     

  6. Edit paths in Homestead.yaml:
    $ nano Homestead.yaml
    Change the folders and sites to:
    folders: 
        - map: ~/homestead/code
          to: /home/vagrant/code
    
    sites:
        - map: survloop.local
          to: /home/vagrant/code/survloop/public

     

  7. Auto-add project(s) to the the /etc/hosts file:
    $ vagrant plugin install vagrant-hostsupdater


2. Install Laravel

$ cd ~/homestead
$ mkdir code $ cd code $ composer create-project laravel/laravel survloop "5.8.*"
$ cd survloop

Edit the environment file to connect the default MYSQL database:

$ nano .env
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret

You could do things like install Laravel's out-of-the-box user authentication tools, and push the vendor file copies where they need to be:

$ php artisan make:auth
$ echo "0" | php artisan vendor:publish --tag=laravel-notifications

3. Install SurvLoop

From your Laravel installation's root directory, update `composer.json` to require and easily reference SurvLoop:

$ nano composer.json
...
"require": {
	...
    "wikiworldorder/survloop": "^0.2.10",
	...
},
...
"autoload": {
	...
	"psr-4": {
		...
		"SurvLoop\\": "vendor/wikiworldorder/survloop/src/",
	}
	...
}, ...

After saving the file, run the update to download SurvLoop, and any missing dependencies.

$ composer update

Laravel Config

Add the package to your application service providers in `config/app.php`.

$ nano config/app.php
...
    'name' => 'SurvLoop',
...
'providers' => [
	...
	SurvLoop\SurvLoopServiceProvider::class,
	...
],
...
'aliases' => [
	...
	'SurvLoop' => 'WikiWorldOrder\SurvLoop\SurvLoopFacade',
	...
], ...

Swap out the SurvLoop user model in `config/auth.php`.

$ nano config/auth.php
...
'model' => App\Models\User::class,
...

Migrate, Publish, and Clean Up

Update composer, publish the package migrations, etc...

$ echo "0" | php artisan vendor:publish --force
$ cd ~/homestead
$ vagrant up
$ vagrant ssh
$ cd code/survloop
$ php artisan migrate
$ composer dump-autoload
$ php artisan db:seed --class=SurvLoopSeeder
$ php artisan db:seed --class=ZipCodeSeeder
$ php artisan optimize:clear

For now, to apply database design changes to the same installation you are working in, depending on your server, you might also need something like this...

$ chown -R www-data:33 app/Models
$ chown -R www-data:33 database

You might need to re-run some things outside the virtual box too, e.g.

$ exit
$ cd ~/homestead/code/survloop
$ php artisan optimize:clear
$ composer dump-autoload

Now you should be able to confirm your successful installation by pulling up http://survloop.local in your browser! You can also connect to the database with apps like Sequel Pro, and default login info.... Host: 127.0.0.1 , Username: homestead , Password: secret , Port: 33060 , Database: homestead .

Initialize SurvLoop Installation

Then browsing to the home page should prompt you to create the first admin user account:

http://survloop.local

If everything looks janky, then manually load the style sheets, etc:

http://survloop.local/css-reload

After logging in as an admin, this link rebuilds many supporting files:

http://survloop.local/dashboard/settings?refresh=2

You can also connect to the database with apps like Sequel Pro, and default login info.... Host: 127.0.0.1 , Username: homestead , Password: secret , Port: 33060 , Database: homestead .

New To Laravel?

Here are some of the basic lessons I've learned in my first three years...

Clearing Caches

You've made changes, but they aren't taking root. You might be able to turn that off and on again with one the common cache clears. These can be run from your Laravel installation's root:

$ php artisan vendor:publish --force
$ php artisan cache:clear
$ php artisan route:cache
$ php artisan view:clear
$ php artisan config:cache
$ php artisan optimize

New To Composer?

Here are some of the basic lessons I've learned in newb land...

$ composer dump-autoload

Updated: November 7, 2019