Slow Line: multi-auth installation with comments
This installation shows how to do this on localhosted Windows server. In my case XAMPP with PHP7 and Apache.
Install Basic version of Laravel 5.2 (not one with Laravel builtin’ single-auth).
Get Command Prompt open (in case you work on Windows machine), or equivalent on Mac, or Linux.
Navigate to folder where you want to install Laravel 5.2. In my case it is U:\www:
Now let’s install Laravel – in my case in folder: /la3
Above command just installed a fresh copy of Laracel into folder U:\www\la3
Download multi-auth files to be merged with your fresh Laravel installation – download multi-auth fileset
Unzip downloaded files and merge with your Laravel installation, overwriting installation files. Multi-auth fileset has proper folder structure for merging.
After unzipping downloaded files, lets merge it with our fresh Laravel installation in U:\www\la3 – of course you will have most likely some other dir, where you installed your copy of Laravel.
Please note, that downloaded multi-auth fileset has proper file structure, so in Windows you can just select and drag content of zip file:
… into U:\www\la3 folder:
NOTE: when asked, allow system to overwrite files in \la3 with files from zip.
Since we overwritten .env file as well, we need to regenerate APP_KEY.
To do that we will use php artisan command.
This key will be auto written to .env file.
You must remove a few defunct now files from your Laravel installation – list of files-for-removal
Even basic Laravel install has some files, which help you jump start your coding, but which now are irrelevant, or even can cause problems – like old migration files.
Let’s remove them.
You can get a full list in zipped text file available for download just above in step 4.
Just make sure you are removing right files.
Setup your .env file – find it in multi-auth fileset. You must create empty database. Then you must set database credentials in .env file.
Now, you need to create an empty database, which will work with your project.
Do not worry about tables at this time – this will be taken care by migration files.
What you need now is database name, user name and database password.
I usually use phpMyAdmin, but you can use anything you like.
Once we have empty database setup, we need to tell Laravel how to connect to it.
We will use .env file.
This file is located in main Laravel folder.
To setup database credentials, we need to find this section:
… and enter: database name, database user and database password.
If you wish to use email capacity for testing, you can send your emails to LOG file, or – like me – you can use SMTP simulator. There are many pieces of software simulating SMTP server on localhost – I use Test Mail Server Tool.
It is simple, easy to setup and does the job – here is its interface:
You set port to listen and folder, where you want tester emails to be stored.
Now, you need to set 2 more sections in .env file, to make tester emails to work on your local machine.
Port must be same as in our Test Mail Server Tool.
We also have to set a bit more, to make sure smtp server works without error. This setup will be useful online, where you may choose to use actual SMTP server.
Email can be totally fake. So can From name.
But we are still not done just yet. There is still one more setting to be taken care for this to work.
We need to pull up config/mail.php file.
Around line #60, you will find this:
Make sure that MAIL_FROM and MAIL_FROM_NAME are defined.
Once we have above done, our project can already connect to database and can send emails locally for testing purposes.
Run migration – migration files are a part of multi-auth fileset, so all you need to do is to run migration command.
So, we have empty database, but it does not have any tables yet. We have migration files ready, but we need to run these files using php artisan.
Lets do this.
I created a la3 database, which is so far empty:
Now, I will run migration command using Command Prompt:
This is artisan confirmation, that tables were created in database.
And here are our tables in database la3 (as seen in phpMyAdmin):
We are done here.
Navigate to your Laravel web page in browser.
If you did everything right, this is what is going to greet you when you open your Laravel project page in browser.
You are done.
Your 3 level multi-auth is fully functional.
Your database tables are empty, so you will not be able to login. Just try to register a few users.