Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ APP_ENV=local
APP_KEY=
APP_DEBUG=true
APP_LOG_LEVEL=debug
DEBUGBAR_ENABLED=true
APP_URL=http://localhost:8000/

API_CHALLENGE=change_me
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Middleware/VerifyCsrfToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ class VerifyCsrfToken extends BaseVerifier
* @var array
*/
protected $except = [
//
'/sms/receive'
];
}
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"maatwebsite/excel": "^2.1",
"nesbot/carbon": "^1.22",
"nexmo/client": "^1.0",
"nexmo/laravel": "^1.0",
"predis/predis": "^1.1",
"spatie/laravel-activitylog": "^2.1",
"yajra/laravel-datatables-buttons": "3.*",
Expand Down
31 changes: 31 additions & 0 deletions config/nexmo.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?php

return [

/*
|--------------------------------------------------------------------------
| API Credentials
|--------------------------------------------------------------------------
|
| If you're using API credentials, change these settings. Get your
| credentials from https://dashboard.nexmo.com | 'Settings'.
|
*/

'api_key' => function_exists('env') ? env('NEXMO_KEY', '') : '',
'api_secret' => function_exists('env') ? env('NEXMO_SECRET', '') : '',

/*
|--------------------------------------------------------------------------
| Signature Secret
|--------------------------------------------------------------------------
|
| If you're using a signature secret, use this section. This can be used
| without an `api_secret` for some APIs, as well as with an `api_secret`
| for all APIs.
|
*/

'signature_secret' => function_exists('env') ? env('NEXMO_SIGNATURE_SECRET', '') : '',

];
18 changes: 18 additions & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,24 @@
*-----------------------*/
Route::resource('site', 'SiteController');

/*-----------------------*
* SMS Controller *
*-----------------------*/
Route::get('/sms/send/{to}', function(\Nexmo\Client $nexmo, $to){
$message = $nexmo->message()->send([
'to' => $to,
'from' => env('NEXMO_FROM'),
'text' => 'This is a test sms message from SmartSettia.'
]);
Log::info('sent message: ' . $message['message-id']);
});
Route::post('/sms/receive', function(\Nexmo\Client $nexmo){
$message = \Nexmo\Message\InboundMessage::createFromGlobals();
Log::info('got text: ' . $message->getBody());
$reply =$nexmo->message()->send($message->createReply('This is for SmartSettia notifications only. Please contact admin@smartsettia.com for assistance.'));
Log::info('sent reply: ' . $reply['message-id']);
});

// TODO
Route::get('unit', 'DashboardController@index')->name('unit');
Route::get('admin', 'DashboardController@index')->name('admin');
Expand Down