Skip to content

Commit

Permalink
using macroable trait
Browse files Browse the repository at this point in the history
  • Loading branch information
vluzrmos committed Feb 23, 2015
1 parent 2566505 commit 4cad0bd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
14 changes: 13 additions & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,19 @@ SlackApi::post('users.admin.invite', ['body' => [
'channels' => 'UXE-!12312,UE0A-23123' //get the channels ids with SlackApi::get('channels.list')
]]);

...
//or create macros to common functions:

SlackApi::macro('inviteMember', function($email, $username="", $channels=""){
return SlackApi::post('users.admin.invite', ['body' => [
'first_name' => $username,
'email' => $email,
'_attempts' => 1,
'channels' => $channels
]]);
});

SlackApi::inviteMember('[email protected]', "John Doe");

```

## License
Expand Down
4 changes: 3 additions & 1 deletion src/Vluzrmos/SlackApi/SlackApi.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@
namespace Vluzrmos\SlackApi;

use GuzzleHttp\Client;
use Illuminate\Support\Traits\Macroable;

class SlackApi{
class SlackApi {
use Macroable;

/**
*
Expand Down

0 comments on commit 4cad0bd

Please sign in to comment.