-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathUsersController.php
33 lines (27 loc) · 993 Bytes
/
UsersController.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
class UsersController extends BaseController {
public function index(){
return View::make('index',['rows'=>User::all(),'window'=>new \KodeInfo\JSHelper]);
}
public function addUser(){
$user=new User();
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->save();
Event::fire(\KodeInfo\Handlers\UserUpdatedEventHandler::EVENT, array(User::all()));
}
public function updateUser(){
$user=User::find(Input::get('id'));
$user->name = Input::get('name');
$user->email = Input::get('email');
$user->save();
Event::fire(\KodeInfo\Handlers\UserUpdatedEventHandler::EVENT, array(User::all()));
}
public function deleteUser($user_id){
User::find($user_id)->delete();
Event::fire(\KodeInfo\Handlers\UserUpdatedEventHandler::EVENT, array(User::all()));
}
public function all(){
return Response::json(User::all());
}
}