Git Product home page Git Product logo

laravel-test-project's Introduction

About

This is a sample laravel project to demonstrate some PHP and Vue JS framework functionality.

Test Information

Part 1

The external currency API is accessible via /currency/australian-dollars. This will return a page which has the JSON result from the API. The relevant files for this part are:

  • app/Http/Api/CurrencyApi.php Which makes the request to the API and returns the result as JSON.
  • app/Http/Controllers/CurrencyController.php Which handles the calling to the currency API and returns a view to the user when accessed via the browser.
  • tests/Feature/CurrencyTest.php - This has the unit tests for this section.

Part 2

I have chosen to implement an interface and a factory. These can be found (along with example usages in the Patterns folder) app/Http/Patterns. These also have unit tests set up: tests/Unit/SquareFactoryTest.php.

Part 3

I have created a simple list of books. This list can be added to or deleted from. The navigation between these components is handled via the vue-router.

  • resources/js - This contains app.js and router.js as well as the components folder.
  • resources/views/layouts/app.blade.php - The main application layout wrapper. This is extended by
    resources/views/book/index.blade.php which imports the Vue components.

Set Up

To set the project up locally, please complete the following steps:

  1. Make sure your system has Node.js 10.13 or later. If you need to install NodeJS, on Ubuntu, run:
sudo apt install nodejs

To check the install succeeded, run:

node -v

This should show the currently installed NodeJS version, eg: v10.19.0.

  1. You will then need to install the Node Package Manager (NPM), for Ubuntu, run the following:
sudo apt install npm
  1. Once NPM has been installed, clone this project from Github by running the following command:
git clone https://github.com/karstenabc/laravel-test-project.git
  1. Enter into the project directory:
cd laravel-test-project
  1. Install the projects' dependencies:
npm install
  1. Finally, run the development server:
npm run dev (if you have followed the above instructions)
# or
yarn dev (if your system is set up with yarn)
  1. Open http://localhost:8000 with your browser.

Usage

Part 1

Visit http://localhost:8000/currency/australian-dollars in your browser.

Part 2

Along with the other parts you can run the unit tests with php artisan test. However, there is no web route for this part.

Part 3

  1. Visit http://localhost:8000/ in your browser. This will show all of the books that have been saved into the local database file. These books can be deleted, and new books can be added.
  2. Click Add Book to be taken to the add book page via vue-router and fill out the details and click Add Book or All Books to go back to viewing all of the stored books.
  3. Click Delete under any book to remove it from the database.

laravel-test-project's People

Contributors

karstenabc 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.