- git clone or download the repository
- create a database named "laravel-exam"
- open the terminal and run composer install
- run the command php artisan migrate:refresh --seed
- run the command php artisan key:generate
- to use the app run the command php artisan serve
-
Get user
- URL: /user/{id}
- Method: Get
- parameter : id
fetch a user base on id
-
Add comment
- URL: /add-comment
- Method: POST
add comment through validated form
-
Add comment via command
- URL: api/add-comment-via-command
- Method: POST
add comment using command line through validated api
Add comment using command line
php artisan add:comment {id} {comment}
User one
'id' => 1,
'name' => 'User Test 1',
'password' => passworduser1,
User two
'id' => 2,
'name' => 'User Test 2',
'password' => passworduser2,
to run a test run the command php artisan test or vendor/bin/phpunit
note: if there is an error run the command php artisan config:clear and rerun the test