@@ -11,18 +11,18 @@ |
||
| 11 | 11 | { |
| 12 | 12 | public function check(Request $request,License $license,Json $json) |
| 13 | 13 | { |
| 14 | - if(empty($request->serial)) |
|
| 15 | - { |
|
| 16 | - $data['active'] = false; |
|
| 17 | - $data['message'] = "Serial number must be provided."; |
|
| 18 | - return $json->response(400,'data',$data,[]); |
|
| 19 | - } |
|
| 20 | - $res = $license->serial($request->serial)->check(); |
|
| 14 | + if(empty($request->serial)) |
|
| 15 | + { |
|
| 16 | + $data['active'] = false; |
|
| 17 | + $data['message'] = "Serial number must be provided."; |
|
| 18 | + return $json->response(400,'data',$data,[]); |
|
| 19 | + } |
|
| 20 | + $res = $license->serial($request->serial)->check(); |
|
| 21 | 21 | if($res->active) |
| 22 | 22 | { |
| 23 | - return $json->response(200,'data',$res,[]); |
|
| 23 | + return $json->response(200,'data',$res,[]); |
|
| 24 | 24 | } |
| 25 | - return $json->response(400,'data',$res,[$res->message]); |
|
| 25 | + return $json->response(400,'data',$res,[$res->message]); |
|
| 26 | 26 | |
| 27 | 27 | } |
| 28 | 28 | } |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class Json |
| 8 | 8 | { |
| 9 | - public function response($status, $key_data = 'data', $data=null, $errors=null) |
|
| 9 | + public function response($status, $key_data = 'data', $data=null, $errors=null) |
|
| 10 | 10 | { |
| 11 | 11 | return response()->json([ |
| 12 | 12 | 'status' => $status, |
@@ -8,26 +8,26 @@ |
||
| 8 | 8 | |
| 9 | 9 | class SerialGenerator extends SerialType |
| 10 | 10 | {
|
| 11 | - protected function generateSerial() |
|
| 11 | + protected function generateSerial() |
|
| 12 | 12 | {
|
| 13 | - if(config('irfa.app_license_server.char_type') == "alphanumeric") {
|
|
| 13 | + if(config('irfa.app_license_server.char_type') == "alphanumeric") {
|
|
| 14 | 14 | |
| 15 | - return $this->alphanumeric(); |
|
| 15 | + return $this->alphanumeric(); |
|
| 16 | 16 | |
| 17 | - } elseif(config('irfa.app_license_server.char_type') == "numeric") {
|
|
| 17 | + } elseif(config('irfa.app_license_server.char_type') == "numeric") {
|
|
| 18 | 18 | |
| 19 | - return $this->numeric(); |
|
| 19 | + return $this->numeric(); |
|
| 20 | 20 | |
| 21 | - } |
|
| 22 | - elseif(config('irfa.app_license_server.char_type') == "alphabet") {
|
|
| 21 | + } |
|
| 22 | + elseif(config('irfa.app_license_server.char_type') == "alphabet") {
|
|
| 23 | 23 | |
| 24 | - return $this->alphabet(); |
|
| 24 | + return $this->alphabet(); |
|
| 25 | 25 | |
| 26 | - } else {
|
|
| 27 | - throw new \Exception('\''.config('irfa.app_license_server.char_type').'\' is not supported, supported char type : alphanumeric, numeric, or alphabet');
|
|
| 26 | + } else {
|
|
| 27 | + throw new \Exception('\''.config('irfa.app_license_server.char_type').'\' is not supported, supported char type : alphanumeric, numeric, or alphabet');
|
|
| 28 | 28 | |
| 29 | - return false; |
|
| 30 | - } |
|
| 29 | + return false; |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | } |
| 33 | 33 | |
@@ -18,8 +18,7 @@ |
||
| 18 | 18 | |
| 19 | 19 | return $this->numeric(); |
| 20 | 20 | |
| 21 | - } |
|
| 22 | - elseif(config('irfa.app_license_server.char_type') == "alphabet") {
|
|
| 21 | + } elseif(config('irfa.app_license_server.char_type') == "alphabet") {
|
|
| 23 | 22 | |
| 24 | 23 | return $this->alphabet(); |
| 25 | 24 | |
@@ -20,9 +20,9 @@ |
||
| 20 | 20 | |
| 21 | 21 | return $sn; |
| 22 | 22 | } |
| 23 | - protected function alphanumeric() |
|
| 23 | + protected function alphanumeric() |
|
| 24 | 24 | {
|
| 25 | - return $this->sn()->setConfig([ |
|
| 25 | + return $this->sn()->setConfig([ |
|
| 26 | 26 | 'length' => config('irfa.app_license_server.length'),
|
| 27 | 27 | 'segment' => config('irfa.app_license_server.segment'),
|
| 28 | 28 | 'seperator' => $this->seperator, |
@@ -89,12 +89,12 @@ discard block |
||
| 89 | 89 | |
| 90 | 90 | protected function disableSN($sn) |
| 91 | 91 | {
|
| 92 | - return LicenseSerial::where('serial',$sn)->update(['status'=>1]);
|
|
| 92 | + return LicenseSerial::where('serial',$sn)->update(['status'=>1]);
|
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | protected function enableSN($sn) |
| 96 | 96 | {
|
| 97 | - return LicenseSerial::where('serial',$sn)->update(['status'=>0]);
|
|
| 97 | + return LicenseSerial::where('serial',$sn)->update(['status'=>0]);
|
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | protected function renewSN($sn,$days) |
@@ -112,6 +112,6 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | } |
| 114 | 114 | $return['message'] = "Renew serial number Failed because serial number not exists."; |
| 115 | - return $return; |
|
| 115 | + return $return; |
|
| 116 | 116 | } |
| 117 | 117 | } |
@@ -22,7 +22,7 @@ discard block |
||
| 22 | 22 | |
| 23 | 23 | public function disable() |
| 24 | 24 | {
|
| 25 | - return $this->disableSN($this->serial); |
|
| 25 | + return $this->disableSN($this->serial); |
|
| 26 | 26 | } |
| 27 | 27 | |
| 28 | 28 | public function enable() |
@@ -49,7 +49,7 @@ discard block |
||
| 49 | 49 | return (object)['active' => false,'message' => "Serial Number is Disabled"]; |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | - return (object)['active' => true,'message' => "Serial Number is valid"]; |
|
| 52 | + return (object)['active' => true,'message' => "Serial Number is valid"]; |
|
| 53 | 53 | } else{
|
| 54 | 54 | return (object)['active' => false,'message' => "Serial Number invalid"]; |
| 55 | 55 | } |
@@ -6,6 +6,6 @@ |
||
| 6 | 6 | |
| 7 | 7 | class LicenseSerial extends Model |
| 8 | 8 | { |
| 9 | - protected $table = 'license_serials'; |
|
| 9 | + protected $table = 'license_serials'; |
|
| 10 | 10 | protected $fillable = ['name','domain','phone_number','address','serial','expired','status']; |
| 11 | 11 | } |
@@ -1,7 +1,7 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | - return [ |
|
| 2 | + return [ |
|
| 3 | 3 | |
| 4 | - /* |
|
| 4 | + /* |
|
| 5 | 5 | |-------------------------------------------------------------------------- |
| 6 | 6 | | License Route |
| 7 | 7 | |-------------------------------------------------------------------------- |
@@ -10,9 +10,9 @@ discard block |
||
| 10 | 10 | | https://yoursite.com/check/license |
| 11 | 11 | | |
| 12 | 12 | */ |
| 13 | - 'license_route' => '/check/license', |
|
| 13 | + 'license_route' => '/check/license', |
|
| 14 | 14 | |
| 15 | - /* |
|
| 15 | + /* |
|
| 16 | 16 | |-------------------------------------------------------------------------- |
| 17 | 17 | | Route name |
| 18 | 18 | |-------------------------------------------------------------------------- |
@@ -20,9 +20,9 @@ discard block |
||
| 20 | 20 | | Set route name for checking serial number. |
| 21 | 21 | | |
| 22 | 22 | */ |
| 23 | - 'route_name' => 'check_license', |
|
| 23 | + 'route_name' => 'check_license', |
|
| 24 | 24 | |
| 25 | - /* |
|
| 25 | + /* |
|
| 26 | 26 | |-------------------------------------------------------------------------- |
| 27 | 27 | | Character Type |
| 28 | 28 | |-------------------------------------------------------------------------- |
@@ -34,9 +34,9 @@ discard block |
||
| 34 | 34 | | |
| 35 | 35 | */ |
| 36 | 36 | |
| 37 | - 'char_type' => 'alphanumeric', //Type alphanumeric |
|
| 37 | + 'char_type' => 'alphanumeric', //Type alphanumeric |
|
| 38 | 38 | |
| 39 | - /* |
|
| 39 | + /* |
|
| 40 | 40 | |-------------------------------------------------------------------------- |
| 41 | 41 | | Serial Config |
| 42 | 42 | |-------------------------------------------------------------------------- |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | | striped : striped segment for serial |
| 47 | 47 | | |
| 48 | 48 | */ |
| 49 | - 'length' => 4,//default : 4 |
|
| 49 | + 'length' => 4,//default : 4 |
|
| 50 | 50 | |
| 51 | - 'segment' => 4,//default : 4 |
|
| 51 | + 'segment' => 4,//default : 4 |
|
| 52 | 52 | |
| 53 | - 'striped' => true,//default : true |
|
| 53 | + 'striped' => true,//default : true |
|
| 54 | 54 | |
| 55 | 55 | |
| 56 | 56 | |