Skip to content

Latest commit

 

History

History
192 lines (150 loc) · 4.08 KB

README.md

File metadata and controls

192 lines (150 loc) · 4.08 KB

Challenge BP

Table of contents

Intro

The objective of this project is Create a project with Laravel 8 and Livewire where the following elements should be used. See Original requirements

Scope Issues
  • Environment
Create environment local
  • Models
  • Migrations
  • Seeders
  • Factories
  • Commands
Sample Data
  • Commands
  • Jobs
Through a Jobs obtain salesOrdersTotal
  • Livewire
Show the data of the generated orders in the fe

Setup environment

requirements

  • GIT
  • Docker
  • Docker-compose or docker compose

(*) Validated in Linux based environments

Commands

  • bin/docker {up | start | stop | allstop | restart | logs | removeproject}
  • bin/composer
  • bin/artisan

Install

See full video

Clone repository

mkdir -p ~/domains/challenge_bp
cd $_

git clone https://github.com/mmaximo33/challenge_bp ./

Start project

chmod +x bin/*

bin/docker up

Check status

Check the following urls

#App
http://localhost/

#Phpmyadmin
http://localhost:8080

Custom Domains

You can create a custom domain by replacing mydomain.lcl from the following command

grep -qxF '127.0.0.1 mydomain.lcl' /etc/hosts || echo "127.0.0.1 mydomain.lcl" | sudo tee -a /etc/hosts

Validate Task

1 Create environment local

If I get to this point and you are viewing the Laravel screen, we have validated this requirement

You can see the available commands by running

bin/artisan list | egrep mm:

2 Sample Data

To validate this requirement we must do the following:

Custom mode

The following will happen

  • Verify that the tables exist
    • Otherwise there will be a risk of artisan migration.
  • It will ask you for the amount of random data to create for
    • Run the factories to
      • Products
      • Orders
      • Order lines
  • Create sample data
  • It will return the result on the screen
# Load sample data
bin/artisan mm:data:example

# Clean 
bin/artisan migrate:rollback

Simple mode

The following will happen

  • Migrations will be loaded
  • The factories are loaded with the values established in the requirement
# Load sample data
bin/artisan migrate --seed

# Clean
bin/artisan migrate 

3 Through a Jobs obtain salesOrdersTotal

The next command available to continue performing the tasks.

  • Dispatch a job which uses the Orders model to obtain the total sales made so far
bin/artisan mm:salesorders:total

4 Show the data of the generated orders in the FE

The data generated in the previous tasks is displayed in the root url of the project

  • General filter
  • Items per page
  • Pagination
  • Sorted by fields