Skip to content

Instantly share code, notes, and snippets.

@nissicreative
Last active December 11, 2019 18:14
Show Gist options
  • Save nissicreative/17d6a1b9d43685c7c8cc87b37df77e9f to your computer and use it in GitHub Desktop.
Save nissicreative/17d6a1b9d43685c7c8cc87b37df77e9f to your computer and use it in GitHub Desktop.
Laravel Site Setup

Laravel Project Setup

Configure Homestead Virtual Machine

(Create local database)

Update Homestead YAML File (sites and databases):

subl ~/Homestead/Homestead.yaml
# shortcut: subl hsyaml

Update Hosts File:

subl /etc/hosts
# shortcut: subl hhosts

Provision VM:

cd ~/Homestead
# shortcut: cdhome

vagrant provision
# alias: vp

Create Project

cd ~/Code

composer create-project --prefer-dist laravel/laravel myproject
# shortcut: ccp

Initialize Git

cd myproject

git init
git add .
git commit -m 'Installed Laravel'

# alias: gnew 'Installed Laravel'

Auth Scaffolding

php artisan make:auth

Queue Tables

php artisan queue:table #if using database driver
php artisan queue:failed-table

Create helpers.php

# Composer will complain if this file is not present!
touch app/helpers.php

Composer: Add Packages

composer require \
barryvdh/laravel-debugbar \
bugsnag/bugsnag-laravel \
guzzlehttp/guzzle \
jrm2k6/cloudder \
lab404/laravel-impersonate \
laracasts/flash \
laravel/telescope \
laravelcollective/html \
nissicreative/laravel-recaptcha dev-master \
nissicreative/phptools dev-master \
owen-it/laravel-auditing \
predis/predis \
rutorika/sortable \
spatie/laravel-backup

# Dev Packages
composer require --dev nissicreative/laravel-generators dev-master \
mpociot/laravel-test-factory-helper

# Laravel Cashier
composer require \
laravel/cashier \
dompdf/dompdf

# Admin Extras
composer require \
league/csv \
unisharp/laravel-filemanager

# Install/publish config files
php artisan telescope:install
php artisan vendor:publish --provider="OwenIt\Auditing\AuditingServiceProvider" --tag="config"
php artisan vendor:publish --provider "OwenIt\Auditing\AuditingServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="Spatie\Backup\BackupServiceProvider"

Create Sublime Project

subl .

Configure App

.env

DB_DATABASE=<database_name>

...

MAIL_USERNAME=<mailtrapuser>
MAIL_PASSWORD=<mailtrappass>

config/app.php

    'providers' = [
        // ...
        Bugsnag\BugsnagLaravel\BugsnagServiceProvider::class,
        Rutorika\Sortable\SortableServiceProvider::class,
    ]

    'aliases' = [
        // ...
        'Bugsnag' => Bugsnag\BugsnagLaravel\Facades\Bugsnag::class,
    ]

config/mail.php

//...

    'from' => [
        'address' => env('MAIL_FROM_ADDRESS', 'noreply@example.com'),
        'name' => env('MAIL_FROM_NAME', 'Project Name'),
    ],

//...

config/logging.php

    'channels' => [
        'stack' => [
            'driver' => 'stack',
            // Add bugsnag to the stack:
            'channels' => ['daily', 'bugsnag'],
        ],

        // ...

        // Create a bugsnag logging channel:
        'bugsnag' => [
            'driver' => 'bugsnag',
        ],
    ],

composer.json

{
    // ...
    "require": {
        // ...
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ],
        "files": [
            "app/helpers.php"
        ]
    },
    // ...
}

Install Boilerplate Files

USING VM, publish files from laravel-boilerplate directory:

# Must be done from virtual machine. BSD doesn't support necessary cp flags.
vm

cd ~/Code && cp -RT laravel-boilerplate/ {project_directory}/
# alias: ccplb (from project root)

Update Git

git add .
git commit -m 'Installed Boilerplate'
# alias: gq 'Installed Boilerplate'

Admin Area

Add line to array in app/Http/Kernel

protected $routeMiddleware = [
    // ...
    'admin' => \App\Http\Middleware\Admin::class,
];

Install npm Dependencies

(Edit webpack.mix.js as necessary)

npm install
npm i -D \
vue \
bootstrap \
bootstrap4-utilities \
jquery \
popper.js \
@fortawesome/fontawesome-pro \
@fancyapps/fancybox \
form-backend-validation \
jquery-ui \
dropzone \
select2 \
npm run develop # nrd

Update Git

git add .
git commit -m 'Installed Dependencies'
# alias: gq 'Installed Dependencies'

Create Repository

git remote add origin git@bitbucket.org:mikefolsom/MYREPO.git
git push -u origin master

Add to Tower

gittower .
# alias: gt .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment