https://github.com/thangngoc89/ng-admin-for-laravel
This help you can create a quick AngularJS backend with ng-admin for Laravel
https://github.com/thangngoc89/ng-admin-for-laravel
Last synced: 1 day ago
JSON representation
This help you can create a quick AngularJS backend with ng-admin for Laravel
- Host: GitHub
- URL: https://github.com/thangngoc89/ng-admin-for-laravel
- Owner: thangngoc89
- Created: 2014-12-27T15:56:01.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-28T14:06:06.000Z (over 10 years ago)
- Last Synced: 2025-03-12T23:48:57.429Z (3 months ago)
- Language: PHP
- Size: 348 KB
- Stars: 1
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
ng-admin-for-laravel
====================This help you can create a quick AngularJS backend with ng-admin for Laravel
#How to ?
- Require [Laravel API Handler](https://github.com/marcelgwerder/laravel-api-handler)
- Create a [RESTful Controller with Laravel](http://laravel.com/docs/4.2/controllers#restful-resource-controllers)Ex: `php artisan controller:make UserController`
- Place this function in the class
- Copy `APIController.php` to `app/controllers.php`.
- extends `APIController` class instead of `BaseController` in your controller/Here is an example of User API
````
user = $user;
}
public function index()
{
try{
$statusCode = 200;
$builder = ApiHandler::parseMultiple($this->user->with('history'), array('name,username'), $this->passParams('users'));
$users = $builder->getResult();
$response = [];
foreach($users as $user){
$response = [
'id' => $user->id
'user' => $user->username,
'name' => $user->name,
];
}return $this->makeResponse($response,$statusCode, $builder);
}catch (Exception $e){
$statusCode = 500;
$message = $e->getMessage();
return Response::json($message, $statusCode);
}
}
}
````
Finally, using [ng-admin](https://github.com/marmelab/ng-admin) to call index and you will see the magic