Basic Laravel 7 Setup with Auth

Written by SarahS

27th April 2020

This is how to set up a new Laravel install with everything you need to get started including Auth.

1: go to Terminal and create a new Laravel project

laravel new projectName

2: add Auth with these two commands

composer require laravel/ui
php artisan ui vue --auth

3: once installed you will be prompted to run this also:

npm install && npm run dev

4: now set up your database. Open your database UI and create a new one with an appropriate name. Then add connection information to the .env file in your project.
It will look something like this:

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=dbname
DB_USERNAME=root
DB_PASSWORD=password

5: set up the auth tables by going back to Terminal and running

php artisan migrate

6: add telescope so you can check the logs and errors

composer require laravel/telescope --dev
php artisan telescope:publish

7: add detailed error messages

composer require facade/ignition

8:until we set up a proper mailing service, make all emails logged by going to .env and changing this

MAIL_DRIVER=log

when changing the .env make sure it works by running this in Terminal:

php artisan config:clear

9: add fancy error pages (if you like)

composer require laravelcollective/errors

and then run this to get it to work:

php artisan vendor:publish

and then finally
10: now run this and check your app is live on localhost

php artisan serve

try registering and logging in/out etc. to see if your new project is up and working correctly.

This is one of my Laravel posts.  I’m still learning Laravel so the posts are usually pretty basic and are more aimed at keeping track of things that I find useful so that I can come back to them again at a later date.  I hope you find them useful too.  If not, or if you think they are wrong then please leave a comment below.  Thank you.

Faster Laravel Hosting

If this post helped you or if you have any questions please leave me a comment below:

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

You May Also Like…

Setting up SQLite for Laravel

Setting up SQLite for Laravel

Sometimes you may decide you want to use SQLite for your Laravel app instead of a full blown MySQL database. In that...