How I setup my basic Laravel 5.8 project

Make authentication

php artisan make:auth

Create the database (UTF8), modify .ENV file accordingly

CREATE SCHEMA `readxlsx4` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

In the config/database.php edit the mysql section (charset, collation, credentials)

'mysql' => [
            'database' => env('DB_DATABASE', 'forge'),
            'username' => env('DB_USERNAME', 'forge'),
            'password' => env('DB_PASSWORD', ''),
            'charset' => 'utf8',
            'collation' => 'utf8_general_ci',
]

Create default database tables to make authentication work

php artisan migrate

Disable user registration by adding in routes/web.php

Auth::routes(['verify' => true, 'register' => false]);

Create a new controller with model from the console

php artisan make:controller UploadXlsxController --model=UploadXlsx

Make certain routes available for logged in users and for guests

//routes/web.php
Route::group(['middleware' => ['auth']], function () {
    //only authorized users can access these routes
});

Route::group(['middleware' => ['guest']], function () {
    //only guests can access these routes
});

Git console / gitbash – basic console commands

#show commit history
git log

#list files modified on a certain commit
git diff-tree --no-commit-id --name-only -r commit-hash

#list files modified within last 30 days
git diff --name-only "@{30 days ago}"

#list remote branches 
git fetch 
git branch -r 
git ls-remote --heads 
git remote show origin

git branch -vv # list local branches

git checkout -b BRANCHNAME # create a new branch and switch to it
git push --set-upstream origin BRANCHNAME # push your new branch to remote repo

git checkout BRANCHNAME    # switch to a branch BRANCHNAME
git push origin BRANCHNAME # push your branch to github

#merge master branch into feature branch
git checkout F1 # switch to branch F1
git merge master # merge from master branch

# completely remove all staged and unstaged changes to tracked files
git reset --hard

#config
git config --list
git config --global user.name "John Doe"
git config --global user.email johndoe@example.com

#if git is tracking files that should be ignored by .gitignore
git rm -r --cached .
git add .
git commit -m "fixed untracked files"

git branch -d branch_name    #delete local branch
git push origin --delete dev #delete remote branch

Oneliners

#delete directories older than 20 days and not older than 365 days
find /home/username/backup/ -type d -mtime +20 -mtime -365 -exec rm -rf {} \;

#delete pdf files older than 6 days but not older than 365 days
find /home/username/public_html/storage/ -type f -mtime +6 -mtime -365 -name '*.pdf' -exec rm {} \