Giter VIP home page Giter VIP logo

laravel-api-test's Introduction

laravel-api-test

Laravel task: Create api calls for a mini online store.

The following models must exist: User, Product, Order. There will be the following relations: The User can have multiple Products and Orders, the Order has multiple Products, but one User.

The following api calls need to be created:

  • User login / register,
  • Create product,
  • Create order,
  • Get my orders

User login / register: Email and password will be used. In addition, there is an optional "locale" field that should be saved in the database if sent. (locale is a language, it can be “sr”, “en”, “de” ....). Return User model as Resource.

Create product: The product has a name and a price. Return the product model as Resource.

Create order: We send a series of products, and then it is necessary to calculate the price of the order and return the order model as Resource. Please note that the user cannot purchase their own product. Display an error message in this case. Return the Order model as Resource.

Get my orders: Restore the collection of Orders of the logged-in User as Resource.

It is necessary to handle all cases, if, for example, at the registration the user does not send an email, return the appropriate error message. It is necessary to use middleware for user authentication (use JWT: https://github.com/firebase/php-jwt) and resources to return results to the user - https://laravel.com/docs/8.x/eloquent-resources.

laravel-api-test's People

Contributors

milosevicn avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.