# Laravel 5.7 Installation
We have split this installation into 3 parts
- Pre-requisites
- Installation
- after setup
# Pre-requesites
To use JOSH which is a developer-oriented product, you should have a basic idea of following tools and make sure they are installed in your system.
Windows Users If you don't want to install all of them manually, please download laragon (opens new window)
# Git
you can check if you have git by running git --version
in terminal, if you don't have it...you can get it from git-scm.com
or on *nix system, you can install by running apt-get install git
command
# nodejs
you can check if you have nodejs installed or not by running nodejs -v
in terminal, if you don't have it... you can get it from nodejs.org
for *nix system, find instructions here https://nodejs.org/en/download/package-manager/ (opens new window)
# yarn
you can check for yarn existence by running yarn -v
in the terminal, if you don't have it, you can get from their website https://yarnpkg.com (opens new window) and follow instructions mentioned there
# composer
you can check for composer existence by running composer -v
in terminal and if you don't have it, get it from getcomposer.org
# Installation
The zip file contains all laravel files integrated with josh, however, you need to perform the following steps to get vendors etc.
# .env file and setting your values
Since everyone can have their database name, mail settings etc, laravel doesn't ship with .env.
but .env.example
which we copy as .env
and modify with our DB details etc.
cp .env.example .env
For Windows Users
copy .env.example .env
now open .env
and modify database etc. details with yours
you need to modify the following values
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
you may need to change other fields as well, if necessary
# Get Composer packages
We don't add all vendors files into zip, hence you need to get them manually, running below command can get you all composer vendor packages
composer install
# permissions
TIP
Windows users don't need follow these steps
Laravel requires directories within the storage
and the bootstrap/cache
directories should be writable by your web server
You should use the minimum permissions available for writing, based on how you've got your web server configured.
chmod -R 775 storage
chmod 775 bootstrap/cache
I f you still run into a permissions error, you may need to increase the permissions to 777, or twiddle your user/group permissions on your server.
chmod -R 777 storage
chmod 777 bootstrap/cache
You'll also want to make sure that your laravel directory and all files within are owned by something other than root. It's very common to create a user on your server (like www-data), add that user to the apache group, and then chown your files to be owned by www-data, chgrp to the apache group.
This ensures your files can be executed correctly and cache files can be written to without having to give files owned by root the permissions to write or execute.
# Mails
If you want to send emails from your website, you need to configure MAIL_DRIVER
etc details in your .env
file, if you don't want to send emails (ex: in dev environment), you can set MAIL_DRIVER
to log
and it will write all your emails to log files.
Global 'from' address
You can specify from
address from each email from mailables
however if you wish to have a single global from
address then please modify config/mail.php
below section with your values
'from' => [
'address' => env('MAIL_FROM_ADDRESS', '[email protected]'),
'name' => env('MAIL_FROM_NAME', 'Example'),
],
WARNING
If you want to use other mail drivers like sparkpost, mailgun
etc, then please refer to https://laravel.com/docs/5.7/mail (opens new window)
# Generate Key
To secure user sessions and other encrypted data, we need to set application key.
php artisan key:generate
# add tables to the database
Now that, we have set up database details in .env
, its time to migrate tables into database.
To have default admin user, we need to seed data into data, to do that run below command, which insert two users into the database.
User email | password | Role |
---|---|---|
[email protected] | admin | admin |
[email protected] | user | user |
along with users, it also inserts all countries data into countries
table.
TIP
If you want to have some dummy in datatables examples, please run
php artisan db:seed --class=DatatablesSeeder
# compiling assets
Now we need to get frontend assets and move them to the proper place.
yarn install
npm run dev
if everything compiles successfully, by now you should have a working website
you can access your website at http://URL/public (opens new window) (if not using virtualhosts) or http://URL (opens new window) (if using virtualhosts) and you can access admin section by going to http://URL/public/admin (opens new window) or http://URL/admin (opens new window) respectively.
# After setup
Still, we need to get some keys and set up things to make sure josh is working properly
# Uploads folders permission
TIP
Windows users don't need to follow these steps
we need to provide write permission to the following folder
public/uploads/blog
public/uploads/crudfiles
public/uploads/files
public/uploads/news
public/uploads/users
# CRUD folders permission
our GUI crud generator writes new files to many folders and if you are on *nix, you need to adjust permissions
please check GUI CRUD page for details
# Recaptcha keys
Josh has Google recaptcha feature for signup, login etc
follow this guide to set recaptcha
# Analytics keys
Josh admin panel can display Google analytics data right in your josh dashboard without leaving the site, for which you need to get JSON file from google site and set analytics view
follow https://github.com/spatie/laravel-analytics#how-to-obtain-the-credentials-to-communicate-with-google-analytics (opens new window) for more details
# Google map keys
you need to get google maps keys for maps pages to work, if you don't need these pages, you can ignore it.
# Social Login
you can see facebook etc login options in signup and login pages, to make them work properly, please follow this guide