Giter Site home page Giter Site logo

atunje / pet-shop Goto Github PK

View Code? Open in Web Editor NEW
9.0 1.0 4.0 459 KB

Shop api for customer management, product ordering and payments; accomodating both admin and customers

Shell 0.09% PHP 98.51% JavaScript 0.02% Blade 1.38%
api-rest jwt laravel products shop shopping brands

pet-shop's Introduction

Pet-Shop API

Pet-Shop Laravel Application.

This repo is functionality complete โ€” PRs and issues welcome!


Getting started

Installation

Clone the repository

git clone [email protected]:Atunje/pet-shop.git

Switch to the repo folder

cd pet-shop

Install all the dependencies using composer

composer install

Copy the example env file and make the required configuration changes in the .env file

cp .env.example .env

Generate a new application key

php artisan key:generate

Run the database migrations (Set the database connection in .env before migrating)

php artisan migrate

Start the local development server

php artisan serve

You can now access the server at http://localhost:8000/api/v1

TL;DR command list

git clone [email protected]:Atunje/pet-shop.git
cd pet-shop
composer install
cp .env.example .env
php artisan key:generate

Make sure you set the correct database connection information before running the migrations Environment variables

php artisan migrate
php artisan serve

Database seeding

Populate 50 orders for 10 different users with a random amount of products, these orders will get randomly assigned a order status, if the order status is paid or shipped it is assigned a payment method.

Run the database seeder and you're done

php artisan db:seed

Note : It's recommended to have a clean database before seeding. You can refresh your migrations at any point to clean the database by running the following command

php artisan migrate:refresh

Code overview

Dependencies

Dev Dependencies

Folders

  • app - Contains all the Eloquent models
  • app/DTOs - Contains the Data Transfer Object classes
  • app/Extensions - Contains the JWT Guard implementation
  • app/Http/Controllers - Contains all the controllers
  • app/Http/Middleware - Contains the middlewares
  • app/Http/Requests - Contains all the api form requests
  • app/Http/Resources - Contains all the api resource files
  • app/Http/Services - Contains the services
  • config - Contains all the application configuration files
  • database/factories - Contains the model factory for all the models
  • database/migrations - Contains all the database migrations
  • database/seeds - Contains the database seeder
  • routes - Contains all the api routes defined in api_v1.php file
  • tests - Contains all the application tests
  • tests/Feature - Contains all the api tests

Environment variables

  • .env - Environment variables can be set in this file

Note : You can quickly set the database information and other variables in this file and have the application fully working.


Documentation

The api documentation can be accessed at http://localhost:8000/api/documentation.

After seeding the database, the default admin credentials are:


pet-shop's People

Contributors

atunje avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

pet-shop's Issues

API desigantion and structure

Routes file works and is fine, but looks a little bloated and will keep getting bloated, follow no specific convention and ensure that business logic will be scattered either in the controller or services. I suggest the use of a resource based API definition to handle 95% of the routes, mapping requests to dynamic routes which in turn would map to resources (Controllers, Models, Resources, Service Layers etc) as required or defined. This would give you a structured approach to how API's are defined and used and also define a philosophy behind API tests and documentation (using things like Swagger).

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.