-
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.
- Loading branch information
¨Goodness
committed
May 25, 2017
0 parents
commit 4f0e2c1
Showing
10 changed files
with
718 additions
and
0 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,20 @@ | ||
{ | ||
"name": "goodnesskay/laravel-slack", | ||
"description": "A Laravel Package that makes Invitation to Slack Channels seamless", | ||
"type": "library", | ||
"license": "MIT", | ||
"keywords": ["laravel","packages","slack","Automatic Invite","SLack Api"], | ||
"authors": [ | ||
{ | ||
"name": "Goodness Toluwanimi Kayode", | ||
"email": "gtkbrain@gmail.com" | ||
} | ||
], | ||
"minimum-stability": "dev", | ||
"require": {}, | ||
"autoload": { | ||
"psr-4": { | ||
"GoodnessKay\\LaravelSlack\\": "src/" | ||
} | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Laravel Slack package. | ||
* | ||
* (c) Gooodness Toluwanimi Kayode <gtkbrain@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace GoodnessKay\LaravelSlack\Facade; | ||
use Illuminate\Support\Facades\Facade; | ||
|
||
class LaravelSlack extends Facade | ||
{ | ||
protected static function getFacadeAccessor() | ||
{ | ||
return 'laravelslack'; | ||
} | ||
} |
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,17 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Laravel Slack package. | ||
* | ||
* (c) Gooodness Toluwanimi Kayode <gtkbrain@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace GoodnessKay\LaravelSlack; | ||
|
||
class LaravelSlack | ||
{ | ||
|
||
} |
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,59 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Laravel Slack package. | ||
* | ||
* (c) Gooodness Toluwanimi Kayode <gtkbrain@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace GoodnessKay\LaravelSlack; | ||
|
||
use App\Http\Controllers\Controller; | ||
use Illuminate\Http\Request; | ||
use GuzzleHttp\Client; | ||
use Validator; | ||
|
||
|
||
class LaravelSlackController extends Controller | ||
{ | ||
public function __construct() | ||
{ | ||
$this->client = new Client(); | ||
} | ||
|
||
/** | ||
* Shows the landing page of | ||
* Laravel Slack Package | ||
* | ||
*/ | ||
public function slackPage() | ||
{ | ||
return view('slack.slack'); | ||
} | ||
|
||
/** | ||
* Get Email, Validate and Send | ||
* Invite to User | ||
* | ||
*/ | ||
public function sendSlackInvite(Request $request) | ||
{ | ||
$validator= Validator::make($request->all(),[ | ||
'email'=>'required|email' | ||
]); | ||
|
||
if ($validator->fails()) | ||
{ | ||
return redirect()->back()->with('error','Sorry! Please enter a valid mail or you have used this mail here'); | ||
}else{ | ||
$email = $request->input('email'); | ||
$this->client->request('POST', | ||
config('LaravelSlack.slack_team_url').'/api/users.admin.invite?t='.time().'&email='.$email.'&token='.config('LaravelSlack.slack_api_token').'&set_active=true&_attempts=1' | ||
); | ||
return redirect()->back()->with('alert','Congratulation! Your Invite has been sent successfully to your mail'); | ||
} | ||
} | ||
} |
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,52 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Laravel Slack package. | ||
* | ||
* (c) Gooodness Toluwanimi Kayode <gtkbrain@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace GoodnessKay\LaravelSlack; | ||
|
||
use Illuminate\Support\ServiceProvider; | ||
|
||
class LaravelSlackServiceProvider extends ServiceProvider | ||
{ | ||
/** | ||
* Bootstrap the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function boot() | ||
{ | ||
$this->publishes([ | ||
__DIR__.'/config/LaravelSlack.php' => config_path('LaravelSlack.php'), | ||
], 'config'); | ||
|
||
$this->publishes([ | ||
__DIR__.'/views/slack' => resource_path('views/slack'), | ||
]); | ||
|
||
$this->publishes([ | ||
__DIR__.'/views/slack/slack-asset' => public_path('/slack-asset'), | ||
], 'public'); | ||
} | ||
|
||
/** | ||
* Register the application services. | ||
* | ||
* @return void | ||
*/ | ||
public function register() | ||
{ | ||
|
||
$this->loadViewsFrom(__DIR__.'/views/slack','slack'); | ||
$this->mergeConfigFrom( __DIR__.'/config/LaravelSlack.php', 'LaravelSlack'); | ||
$this->app->singleton(LaravelSlack::class, function ($app) { | ||
return new LaravelSlack(config('laravelslack')); | ||
}); | ||
} | ||
} |
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,53 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Laravel Slack package. | ||
* | ||
* (c) Gooodness Toluwanimi Kayode <gtkbrain@gmail.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
return[ | ||
|
||
/** | ||
* Gets the name of the slack team | ||
* | ||
*/ | ||
|
||
'slack_team_name'=> getenv('SLACK_TEAM_NAME'), | ||
|
||
/** | ||
* Gets brief description of the team | ||
* i.e What is being done by the team | ||
* | ||
*/ | ||
|
||
'team_description'=> getenv('TEAM_DESCRIPTION'), | ||
|
||
/** | ||
* Gets the slack url of the team | ||
* e.g test-group.slack.com | ||
* | ||
*/ | ||
|
||
'slack_team_url'=> getenv('SLACK_TEAM_URL'), | ||
|
||
/** | ||
* Gets the slack API token of the team | ||
* Get it at: | ||
* https://api.slack.com/custom-integrations/legacy-tokens | ||
* | ||
*/ | ||
|
||
'slack_api_token'=> getenv('SLACK_API_TOKEN'), | ||
|
||
/** | ||
* Gets the email of the team | ||
* | ||
*/ | ||
|
||
'slack_team_email'=> getenv('SLACK_TEAM_EMAIL'), | ||
|
||
]; |
Large diffs are not rendered by default.
Oops, something went wrong.
Oops, something went wrong.