Skip to content

devmark/laravel-angular-cms

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Laravel Angular CMS Starter Site

Join the chat at https://gitter.im/devmark/laravel-angular-cms

screenshot

Features:

  • Independent Laravel, Angular
  • Laravel 5.1 for API
    • Include Json Auth Token
    • Include Data Transformer
    • Include API Data Exception
    • Output JSON or others
    • Include CSRF Protection
    • Timezone
  • Angular 1.4 for Backend
    • Include AdminLTE template
    • Include ui-router, Restangular etc ...
    • Timezone
    • Support Multi-Languages interface
  • Backend
    • User & Role management
    • Manage Media & Media Categories
    • Manage posts and posts categories
  • Frontend
    • Soon

Install:


Step 1: Get the code

Download Now


Step 2: Init api

Init Laravel

  1. Move to api directory
  2. Run composer install

Init Database

  1. Setup database config in .env file (copy from .env.example)
  2. Run php artisan migrate --seed

Step 3: Init Backend

This project makes use of Bower. You must first ensure that Node.js (included in homestead) is installed on your machine.

  1. Install npm, gulp, bower
  2. Run sudo npm install
  3. Run bower install
  4. Edit backend/src/index.js, replace cms.dev to your api domain
  5. Run gulp serve for development

Step 4: Production

API

  1. edit .env file set APP_DEBUG to false

Backend

  1. run gulp in backend directory. It will auto copy backend/dist all files to api/public/assets-backend

Frontend

  1. Move all frontend files to api/public

Server

Redirect backend:

Nginx
    location ~ ^/backend {
        rewrite ^/backend(.*) /assets-backend/$1 break;
    }
Apache
    RewriteRule ^backend/(.*)\.([^\.]+)$ /assets-backend/$1.$2 [L]

Step 5: Start

  1. access http://yourdomain.com/backend You can now login to admin:

    username: [email protected] password: adminmark


Demo:

Soon


Screenshot:

screenshot screenshot screenshot


API Detail:

Add Exception

Add Whatever Exception you want in api/app/Exceptions

Example:

class EmailOrPasswordIncorrectException extends HttpException
{
    public function __construct($message = null, \Exception $previous = null, $code = 0)
    {
        parent::__construct(401, 'Email/Password is incorrect', $previous, [], 10001);
    }
}

Use it:

    throw new EmailOrPasswordIncorrectException;

Output:

{
    "result":{
        "status":false,
        "code":10001,
        "message":"Email\/Password is incorrect"
    }
}

Add Transformer

It helps to output good format you need. Add new transformer you want in api/app/Transformers More details: see this

class UserTransformer extends TransformerAbstract
{

   public function transform(User $item)
    {
        return [
            'id'            => (int)$item->id,
            'email'         => $item->email,
            'lastname'      => $item->lastname,
            'firstname'     => $item->firstname,
            'phone'         => $item->phone,
            'active'        => (boolean)$item->active,
            'created_at'    => $item->created_at,
            'updated_at'    => $item->updated_at,
        ];
    }
}

Config JWT

Soon

Backend Detail:

Soon

Frontend Detail:

  1. You can move all frontend file to api/public

About

laravel api with angular backend cms

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published