WEB3 PROJECT - HENTGES Thibault & Hafizh Ahmad Zuhdi
as we can't set up some continous testing on this GitLab, you should always run tests before pushing to the master branch
see testing part of this readme
- you need a mysql server (local or distant)
- download and install composer on your machine
- clone the repository
- browse to the cloned repository directory using command line
- install dependencies by typing:
composer install
or, if composer is not installed globally on your machine:php path/to/your/composer.phar install
- copy file
.env.example
in a new.env
file - generate a key:
php artisan key:generate
- replace the values of the database parameters in the newly created .env file with your local values
- generate a jwt key using
php artisan jwt:secret
- copy the newly generate value for
JWT_SECRET
from.env
to.env.testing
file
in order to make the app working better, you'll need to add a default.png
and watermark2.png
into the public/images/
folder.
type php artisan serve
the webserver is now running in development mode on the port 8000 of your local machine!
Try accessing the Home page
php artisan migrate:fresh --seed
will drop current database, create the updated schema, and populate it with random data to work with
- You need an exist default user before
- type
php artisan tinker
- then type the command
use App\User;
- last part you need to change the type by using
User::where('email', '[email protected]')->update(['type' => 'admin']);
- So you now have an admin and can login to admin panel
You can find the documentation of the API here
The authentication is done using Json Web Token (JWT). You need to login using the /api/login
route to retrieve your token.
Then, you have to submit your token either in query parameter token=yourtoken
or headers Authorization: Bearer yourtoken
To run the tests, type this command from the root directory: ./vendor/bin/phpunit
Before running your tests, you need to do these steps once:
- copy file
.env.testing.example
in a new.env.testing
file - fill the
APP_KEY
value in the new created file with the one in your.env
file - replace the values of the database parameters in the newly created .env.testing file with your testing database values