Skip to content

Commit

Permalink
add fence & multicurl library
Browse files Browse the repository at this point in the history
  • Loading branch information
metallurgical committed Feb 3, 2017
1 parent 5098776 commit 71b0349
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
13 changes: 10 additions & 3 deletions src/Repositories/ServiceProvider/ArchServiceProvider.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<?php

namespace Arch\Repositories\ServiceProvider;

use Arch\Repositories\Tools\Libraries\Encryption;
use Arch\Repositories\Tools\Libraries\MultiCurl;
use Illuminate\Support\ServiceProvider;


class ArchServiceProvider extends ServiceProvider
{
private $commandPath = 'command.arch.';
Expand Down Expand Up @@ -30,12 +34,15 @@ public function register()
/*
* Register the service provider for the dependency.
*/
$this->app->register( 'Arch\Repositories\ServiceProvider\ArchServiceProvider' );
//$this->app->register( 'Arch\Repositories\ServiceProvider\ArchServiceProvider' );
/*
* Create aliases for the dependency.
*/
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias( 'Fence', 'Arch\Repositories\Tools\Libraries\Encryption' );
$this->app->booting(function() {
$loader = \Illuminate\Foundation\AliasLoader::getInstance();
$loader->alias( 'Arch\Libs\Fence', Encryption::class );
$loader->alias( 'Arch\Libs\MultiCurl', MultiCurl::class );
});

}
/**
Expand Down
8 changes: 4 additions & 4 deletions src/Repositories/Tools/Libraries/Encryption.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public static function encode ( $toEncode ) {
try {

$hash = new Hashids( self::$salt, 15 );
$encodedVal = $hashids->encode( $toEncode );
$encodedVal = $hash->encode( $toEncode );
return $encodedVal;

}
Expand All @@ -83,9 +83,9 @@ public static function decode ( $toDecode ) {

try {

$hash = new Hashids( self::$salt );
$decodedVal = $hashids->decode( $toDecode );
return $decodedVal;
$hash = new Hashids( self::$salt, 15 );
$decodedVal = $hash->decode( $toDecode );
return $decodedVal[0];

}
catch ( Exception $e ) {
Expand Down

0 comments on commit 71b0349

Please sign in to comment.