/ventures-laravel

Laravel Developer | Tech test

Primary LanguagePHP

Laravel Developer | Tech Test · Laravel MySQL Docker Bootstrap

  • This project is attending to the following requesites
    • Create a development environment withLaravel (LTS/Q1) and Mysql using Sail
    • Create a service class called Placeholder (ex: App\Services\PlaceHolderService)
    • Create a method that will consume the test api on the following endpoint: https://jsonplaceholder.typicode.com/posts
    • Create a Unit Test to validate this functionality
    • Create a model and a migration for a table called “posts” with the following fields: id, title and body
    • Create a command (ex: php artisan placeholder:posts) that, when activated, consumes the api service and records the result in the database (posts table)
    • Create a route, a controller and a view to display the data recorded in the database in the “posts” table, use the frontend technology you like the most and show what you can do in the layout.
    • Upload the application on your GitHub.

Installing / Getting started

Prerequisites

To run this project you must have installed Composer and Docker to run the project with laravel sail.

Once in the project folder you must intall and run the containers with sail.

php composer install
cp .env.example .env
./vendor/bin/sail up
  • after starting the containers you should be abble to acces the home page at: localhost:80

Now in a new shell you can run commands in the container through:

./vendor/bin/sail artisan migrate
./vendor/bin/sail placeholder:posts

Built With

  • Composer
  • Laravel
  • Laravel/sail
  • Bootstrap
  • MySQL

Tests

To run the tests just use the following command:

The test will check if the PlaceHolderService method is working.

./vendor/bin/sail test

Api Reference

There is a simple Rest API to work with Post:

  • GET localhost/api/post
  • POST localhost/api/post
  • GET localhost/api/post/{id}
  • PUT localhost/api/post/{id}
  • DELETE localhost/api/post/{id}

Further work

  • Better configuration on .env files
  • Add CRUD front-end
  • Build and deploy
  • Authentication