generated from combindma/package-skeleton-laravel
-
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
Combind
committed
Mar 22, 2023
1 parent
4f76f19
commit 2bc2547
Showing
11 changed files
with
245 additions
and
9 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,33 @@ | ||
<?php | ||
|
||
// config for Combindma/Mautic | ||
return [ | ||
/* | ||
* Base URL of the Mautic instance | ||
*/ | ||
'baseUrl' => env('MAUTIC_BASE_URL'), | ||
|
||
/* | ||
* Client/Consumer key from Mautic | ||
*/ | ||
'clientKey' => env('MAUTIC_PUBLIC_KEY'), | ||
|
||
/* | ||
* Client/Consumer secret key from Mautic | ||
*/ | ||
'clientSecret' => env('MAUTIC_SECRET_KEY'), | ||
|
||
/* | ||
* Redirect URI/Callback URI for this script | ||
*/ | ||
'callback' => env('MAUTIC_CALLBACK'), | ||
|
||
/* | ||
* Enable or disable Mautic. Useful for local development when running tests. | ||
*/ | ||
'apiEnabled' => env('MAUTIC_ENABLED', false), | ||
|
||
/* | ||
* Filename to use when storing mautic access token. Must be a json File | ||
*/ | ||
'fileName' => 'mautic.json', | ||
]; |
File renamed without changes.
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,14 @@ | ||
<?php | ||
|
||
/* | ||
|-------------------------------------------------------------------------- | ||
| Mautic Application Routes | ||
|-------------------------------------------------------------------------- | ||
| | ||
*/ | ||
|
||
use Combindma\Mautic\Http\Controllers\MauticController; | ||
use Illuminate\Support\Facades\Route; | ||
|
||
Route::get('login/mautic', [MauticController::class, 'login']); | ||
Route::get('login/mautic/callback', [MauticController::class, 'callback']); |
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,14 @@ | ||
<?php | ||
|
||
namespace Combindma\Mautic\Exceptions; | ||
|
||
use Exception; | ||
use Illuminate\Support\Facades\Log; | ||
|
||
class UnableToStoreMauticDataException extends Exception | ||
{ | ||
public function report() | ||
{ | ||
Log::debug('Unable to store Mautic data in your local disk.'); | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
namespace Combindma\Mautic\Http\Controllers; | ||
|
||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests; | ||
use Illuminate\Foundation\Validation\ValidatesRequests; | ||
use Illuminate\Routing\Controller as BaseController; | ||
|
||
class Controller extends BaseController | ||
{ | ||
use AuthorizesRequests; | ||
use ValidatesRequests; | ||
} |
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,26 @@ | ||
<?php | ||
|
||
namespace Combindma\Mautic\Http\Controllers; | ||
|
||
use Combindma\Mautic\Exceptions\UnableToStoreMauticDataException; | ||
use Combindma\Mautic\Facades\Mautic; | ||
use Illuminate\Support\Facades\Storage; | ||
|
||
class MauticController extends Controller | ||
{ | ||
public function login() | ||
{ | ||
Mautic::getAccessTokenData(); | ||
|
||
return view('mautic::index'); | ||
} | ||
|
||
public function callback() | ||
{ | ||
$mauticData = Mautic::getAccessTokenData(); | ||
// The file could not be written to disk... | ||
if (! Storage::disk('local')->put(config('mautic.fileName'), json_encode($mauticData))) { | ||
throw new UnableToStoreMauticDataException('Unable to store Mautic data.'); | ||
} | ||
} | ||
} |
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