Coder Social home page Coder Social logo

user-management's Introduction

CMS example in Laravel 5

A Single-page application example building with Laravel and Angularjs. Project will have two parts, back-end and front-end run separately.

It handles a management user. Some technicals applied to this project:

  • Restful webservice
  • Token-based authentication
  • Validation
  • Paging
  • Middleware
  • Exception handle
  • Elixir
  • PHP artisan
  • NPM
  • Composer
  • Responsive
  • Resolve Cross-origin resource sharing
  • HTML5 local storage

============ TODO:

  • Make Sign Up feature.
  • Write unit test for back-end API

Requirements

  • Vagrant 1.7.4 or later
  • Virtual Box 5.0 or later
  • Laravel/Homestead 2.1.6 or later

Installation

  1. Pull source code from github.

     $ git clone [email protected]:Mulodo-PHP-Laravel-Training/tuan-vu-sample-project-1.git
    
  2. Configuring homestead. To prepare homestead runner, we will have to add some configurations for folders, sites, databases as below to Homestead.yaml file

     - folders: 
         - map: /your/path/tuan-vu-sample-project-1/backend
           to: /home/vagrant/Code/backend
           type: "nfs"
         - map: /your/path/tuan-vu-sample-project-1/frontend
           to: /home/vagrant/Code/frontend
           type: "nfs"
     - sites:
         - map: api.mulodo.dev
           to: /home/vagrant/Code/backend/public
         - map: cms.mulodo.dev
           to: /home/vagrant/Code/frontend
     databases:
         - mulodo
    
  3. Configuring DNS for local run. In hosts file of your computer. Add

     192.168.10.10 api.mulodo.dev
     192.168.10.10 cms.mulodo.dev
    
  4. Preparing database. We need to prepare default database for the first time use. At backend folder, run:

     $ php artisan migrate
     $ php artisan db:seed
    
  5. Set the application key for back-end. At backend folder, run:

     $ php artisan key:generate
    
  6. Start homestead for using

     $ homestead up
    

Usage

We have a default login user for testing. You didn't build sign up function yet.

Email   :   [email protected]
Password:   mulodotest

The project have an UI for client using. You can access via:

http://cms.mulodo.dev

You also can directly access back-end API via Restful webservice as below:

Method  |                  URI                          |                 Parameters              |  Token    |        Action         |
--------------------------------------------------------------------------------------------------------------------------------------
POST    | http://api.mulodo.dev/authentication/signin   | email, password                         | None      | Api authentication    |
GET     | http://api.mulodo.dev/user                    | None                                    | Yes       | User list receipt     | 
GET     | http://api.mulodo.dev/user/{id}               | id                                      | Yes       | User detail receipt   |
POST    | http://api.mulodo.dev/user                    | firstName, lastName, email, password    | Yes       | User registration     |
PUT     | http://api.mulodo.dev/user/{id}               | id                                      | Yes       | User updating         |
DELETE  | http://api.mulodo.dev/user/{id}               | id                                      | Yes       | User remove           |

Pass Token to API

Method: Header
Attribute: Authorization
Token format: Bearer {token}
For example:
- Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6XC9cL2FwaS5tdWxvZG8uZGV2XC9hdXRoZW50aWNhdGlv blwvc2lnbmluIiwiaWF0IjoiMTQ0MjIwNDE5OSIsImV4cCI6IjE0NDIyMDc3OTkiLCJuYmYiOiIxNDQyMjA0MTk5IiwianRpIjoiZjkxYTUyOTM4OTMyNmRlMzdiMzNkYjIyNDU0NmZjNjkifQ .buLjSa10KI2Nk0kfzhCYJmaa3GrpYqZiXYeFK5iDq-8

Credit

Special thanks to Mrs. Tien, Mr. Tam, Mr. Tuan Nguyen and Mr. Kondo have supported me to complete this project.

The project was created rely on frameworks Laravel 5.1, AngularJS 1.4.7, Bootstrap 3.3.5.

In addition, it also used packages as below:

Back-end

jwt-auth: https://github.com/tymondesigns/jwt-auth
laravel-cors: https://github.com/barryvdh/laravel-cors

Front-end

ngRoute: https://docs.angularjs.org/api/ngRoute
angularUtils.directives.dirPagination: https://github.com/michaelbromley/angularUtils/tree/master/src/directives/pagination
ngMessages: https://docs.angularjs.org/api/ngMessages
ngStorage: https://github.com/gsklee/ngStorage
ngResource: https://docs.angularjs.org/api/ngResource

I also reference the articles as below:

Author

Tuan Vu [email protected]

user-management's People

Stargazers

Josh Parkinson avatar

Watchers

James Cloos avatar tuancode avatar

Forkers

he66al

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.