-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Updated routes and Pulse/User controllers
- Loading branch information
1 parent
11d03a0
commit aa03eb6
Showing
5 changed files
with
62 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
class PulseController extends BaseController{ | ||
|
||
public function getAll() | ||
{ | ||
|
||
return Response::json(Pulse::all()); | ||
} | ||
|
||
public function store() | ||
{ | ||
$pulse = new Pulse; | ||
|
||
$pulse->server_id = Input::get("server_id"); | ||
$pulse->ram_usage = Input::get("ram_usage"); | ||
$pulse->cpu_usage = Input::get("cpu_usage"); | ||
$pulse->disk_usage = Input::get("disk_usage"); | ||
$pulse->uptime = Input::get("uptime"); | ||
$pulse->timestamp = Input::get("timestamp"); | ||
|
||
$pulse->save(); | ||
|
||
$pubnub = App::make('pubnub'); | ||
$pubnub->publish(array( | ||
'channel' => 'Cadence', | ||
'message' => json_decode($pulse) | ||
)); | ||
|
||
return Response::json($pulse); | ||
|
||
} | ||
} | ||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
class Pulse extends Eloquent { | ||
|
||
/** | ||
* The attributes excluded from the model's JSON form. | ||
* | ||
* @var array | ||
*/ | ||
protected $fillable = array('ram_usage', 'cpu_usage', 'disk_usage', 'uptime', 'timestamp'); | ||
protected $guarded = array('id', 'server_id'); | ||
public $timestamps = false; | ||
|
||
/** | ||
* Store a newly created resource in storage. | ||
* | ||
* @return Response | ||
*/ | ||
public function store() | ||
{ | ||
// | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters