Skip to content

leonardoakio/Marketplace_Laravel

Repository files navigation

Marketplace

admin.png

The project is based on a marketplace with laravel 6, where we have a stores and products registration, with routes for admin, shopkeepers and the store itself, where customers can make purchases directly on the system.

Table of Contents

Structure

├── app/
├── config/
├── database/
├── public/
├── resources/
├── routes/
├── storage./
├── tests/
├── vendor/
├── artisan
├── composer.json
├── composer.lock
├── package.json
├── phpunit.xml
├── server.php
├── webpack.mix.js
├── yarn.lock

Getting Started

Open and view the Project using the .zip file provided
Or to get started, clone the repository to your directory

> git clone https://github.com/akioleo/Marketplace_Laravel.git

Start the local development server

> php artisan serve

Installation

Install all the dependencies using composer

> composer install

Create a new .env archive based on .env.example

> php -r "copy('.env.example', '.env');"

Generate a new artisan key

> php artisan key:generate

Configuration

In new .env file type your database credentials in these lines
Obs: DB_CONNECTION changes by the database used. Example: Postgre database (pgsql), sqlite, sqlsrv

DB_CONNECTION=mysql  
DB_HOST=127.0.0.1  
DB_PORT=3306  
DB_DATABASE=laravel  
DB_USERNAME=root  
DB_PASSWORD=

Include personal PagSeguro credentials

PAGSEGURO_ENV=sandbox
PAGSEGURO_EMAIL= <yourEmail>
PAGSEGURO_TOKEN_SANDBOX= <token>
PAGSEGURO_CHARSET=UTF-8

Run the database migrations to create predefined database tables

> php artisan migrate  

Run seeds to populate the database with data we want to develop in future

> php artisan db:seed  

Versions

We can check tools versions to avoid some errors

php --version  |  composer --version  |  laravel --version

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

Development

Database relationships

User-Store

1:1 relationship - where one user hasOne store and one store belongsTo an user

$this->hasOne(Store::class);
$this->belongsTo(User::class);

Store-Products

1:N relationship - where one store hasMany products and one product belongsTo an store

$this->hasMany(Product::class);
$this->belongsTo(Store::class);

Products-Categories

N:N relationship - where products belongsToMany categories and categories belongsToMany products

$this->belongsToMany(Product::class);
$this->belongsToMany(Category::class);

Paths

  • app - Contains all the Eloquent models
  • app/Http/Controllers/Api - Contains all the api controllers
  • app/Http/Middleware - Contains the JWT auth middleware
  • app/Http/Requests/Api - Contains all the api form requests
  • app/Payment/PagSeguro/CreditCard - Contains payment rules
  • app/Traits/UploadTrait - Contains all traits of project
  • 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
  • public/assets - Contains public assets of project
  • resources/views - Contains blade documents (front-end)
  • routes - Contains all the api routes defined in api.php file
  • storage/app - Contains private photos
  • tests - Contains all the application tests
  • tests/Feature - Contains all the api tests
  • vendor- Includes the Composer dependencies in the file autoload.
  • .env - A simple text configuration file for controlling your Applications environment constants.
  • composer.json - Contains a project name, version and a few other details
  • composer.lock - Records the exact versions that are installed
  • package.json - Contains few packages such as vue and axios to help you get started building your JavaScript application
  • phpunit.xml- A testing utility included by default in a fresh installation of Laravel

Contributing

We'd love to have your helping hand on Marketplace. If you have any contribuition, we can rate some pull requests.

License

Marketplace is open source software licensed as MIT.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published