@@ -5,53 +5,53 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class OauthClientObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 17 | - |
|
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - $model->secret = str_random(40); |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function updating($model) |
|
| 29 | - { |
|
| 30 | - // |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public function updated($model) |
|
| 34 | - { |
|
| 35 | - // |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - public function deleting($model) |
|
| 39 | - { |
|
| 40 | - // |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function deleted($model) |
|
| 44 | - { |
|
| 45 | - // |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function restoring($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function restored($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + $model->secret = str_random(40); |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function updating($model) |
|
| 29 | + { |
|
| 30 | + // |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + public function updated($model) |
|
| 34 | + { |
|
| 35 | + // |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + public function deleting($model) |
|
| 39 | + { |
|
| 40 | + // |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function deleted($model) |
|
| 44 | + { |
|
| 45 | + // |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function restoring($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function restored($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -5,71 +5,71 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclGroupObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | 12 | |
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Prevent updating of the admin group. |
|
| 30 | - * |
|
| 31 | - * @param object $model the model beign updated. |
|
| 32 | - * @return void |
|
| 33 | - */ |
|
| 34 | - public function updating($model) |
|
| 35 | - { |
|
| 36 | - if ($model->getOriginal('name') == 'Admin') |
|
| 37 | - { |
|
| 38 | - \ErrorHandler::noPermissions(); |
|
| 39 | - } |
|
| 40 | - } |
|
| 28 | + /** |
|
| 29 | + * Prevent updating of the admin group. |
|
| 30 | + * |
|
| 31 | + * @param object $model the model beign updated. |
|
| 32 | + * @return void |
|
| 33 | + */ |
|
| 34 | + public function updating($model) |
|
| 35 | + { |
|
| 36 | + if ($model->getOriginal('name') == 'Admin') |
|
| 37 | + { |
|
| 38 | + \ErrorHandler::noPermissions(); |
|
| 39 | + } |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - public function updated($model) |
|
| 43 | - { |
|
| 44 | - // |
|
| 45 | - } |
|
| 42 | + public function updated($model) |
|
| 43 | + { |
|
| 44 | + // |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * Prevent deleting the admin group. |
|
| 49 | - * |
|
| 50 | - * @param object $model the delted model. |
|
| 51 | - * @return void |
|
| 52 | - */ |
|
| 53 | - public function deleting($model) |
|
| 54 | - { |
|
| 55 | - if ($model->getOriginal('name') == 'Admin') |
|
| 56 | - { |
|
| 57 | - \ErrorHandler::noPermissions(); |
|
| 58 | - } |
|
| 59 | - } |
|
| 47 | + /** |
|
| 48 | + * Prevent deleting the admin group. |
|
| 49 | + * |
|
| 50 | + * @param object $model the delted model. |
|
| 51 | + * @return void |
|
| 52 | + */ |
|
| 53 | + public function deleting($model) |
|
| 54 | + { |
|
| 55 | + if ($model->getOriginal('name') == 'Admin') |
|
| 56 | + { |
|
| 57 | + \ErrorHandler::noPermissions(); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | - public function deleted($model) |
|
| 62 | - { |
|
| 63 | - // |
|
| 64 | - } |
|
| 61 | + public function deleted($model) |
|
| 62 | + { |
|
| 63 | + // |
|
| 64 | + } |
|
| 65 | 65 | |
| 66 | - public function restoring($model) |
|
| 67 | - { |
|
| 68 | - // |
|
| 69 | - } |
|
| 66 | + public function restoring($model) |
|
| 67 | + { |
|
| 68 | + // |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - public function restored($model) |
|
| 72 | - { |
|
| 73 | - // |
|
| 74 | - } |
|
| 71 | + public function restored($model) |
|
| 72 | + { |
|
| 73 | + // |
|
| 74 | + } |
|
| 75 | 75 | } |
| 76 | 76 | \ No newline at end of file |
@@ -5,53 +5,53 @@ |
||
| 5 | 5 | */ |
| 6 | 6 | class AclPermissionObserver { |
| 7 | 7 | |
| 8 | - public function saving($model) |
|
| 9 | - { |
|
| 10 | - // |
|
| 11 | - } |
|
| 12 | - |
|
| 13 | - public function saved($model) |
|
| 14 | - { |
|
| 15 | - // |
|
| 16 | - } |
|
| 17 | - |
|
| 18 | - public function creating($model) |
|
| 19 | - { |
|
| 20 | - // |
|
| 21 | - } |
|
| 22 | - |
|
| 23 | - public function created($model) |
|
| 24 | - { |
|
| 25 | - // |
|
| 26 | - } |
|
| 27 | - |
|
| 28 | - public function updating($model) |
|
| 29 | - { |
|
| 30 | - // |
|
| 31 | - } |
|
| 32 | - |
|
| 33 | - public function updated($model) |
|
| 34 | - { |
|
| 35 | - // |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - public function deleting($model) |
|
| 39 | - { |
|
| 40 | - // |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - public function deleted($model) |
|
| 44 | - { |
|
| 45 | - // |
|
| 46 | - } |
|
| 47 | - |
|
| 48 | - public function restoring($model) |
|
| 49 | - { |
|
| 50 | - // |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - public function restored($model) |
|
| 54 | - { |
|
| 55 | - // |
|
| 56 | - } |
|
| 8 | + public function saving($model) |
|
| 9 | + { |
|
| 10 | + // |
|
| 11 | + } |
|
| 12 | + |
|
| 13 | + public function saved($model) |
|
| 14 | + { |
|
| 15 | + // |
|
| 16 | + } |
|
| 17 | + |
|
| 18 | + public function creating($model) |
|
| 19 | + { |
|
| 20 | + // |
|
| 21 | + } |
|
| 22 | + |
|
| 23 | + public function created($model) |
|
| 24 | + { |
|
| 25 | + // |
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + public function updating($model) |
|
| 29 | + { |
|
| 30 | + // |
|
| 31 | + } |
|
| 32 | + |
|
| 33 | + public function updated($model) |
|
| 34 | + { |
|
| 35 | + // |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + public function deleting($model) |
|
| 39 | + { |
|
| 40 | + // |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + public function deleted($model) |
|
| 44 | + { |
|
| 45 | + // |
|
| 46 | + } |
|
| 47 | + |
|
| 48 | + public function restoring($model) |
|
| 49 | + { |
|
| 50 | + // |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + public function restored($model) |
|
| 54 | + { |
|
| 55 | + // |
|
| 56 | + } |
|
| 57 | 57 | } |
| 58 | 58 | \ No newline at end of file |
@@ -29,6 +29,6 @@ |
||
| 29 | 29 | $group->permissions()->attach($permissionIds); |
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | - return $this->find($groupId); |
|
| 32 | + return $this->find($groupId); |
|
| 33 | 33 | } |
| 34 | 34 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | public function assignPermissions($groupId, $permissionIds) |
| 25 | 25 | { |
| 26 | - \DB::transaction(function () use ($groupId, $permissionIds) { |
|
| 26 | + \DB::transaction(function() use ($groupId, $permissionIds) { |
|
| 27 | 27 | $group = $this->find($groupId); |
| 28 | 28 | $group->permissions()->detach(); |
| 29 | 29 | $group->permissions()->attach($permissionIds); |
@@ -4,37 +4,37 @@ |
||
| 4 | 4 | |
| 5 | 5 | class OauthClientRepository extends AbstractRepository |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * Return the model full namespace. |
|
| 9 | - * |
|
| 10 | - * @return string |
|
| 11 | - */ |
|
| 12 | - protected function getModel() |
|
| 13 | - { |
|
| 14 | - return 'App\Modules\Acl\OauthClient'; |
|
| 15 | - } |
|
| 7 | + /** |
|
| 8 | + * Return the model full namespace. |
|
| 9 | + * |
|
| 10 | + * @return string |
|
| 11 | + */ |
|
| 12 | + protected function getModel() |
|
| 13 | + { |
|
| 14 | + return 'App\Modules\Acl\OauthClient'; |
|
| 15 | + } |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Revoke the given client. |
|
| 19 | - * |
|
| 20 | - * @param integer $clientId |
|
| 21 | - * @return void |
|
| 22 | - */ |
|
| 23 | - public function revoke($clientId) |
|
| 24 | - { |
|
| 25 | - $client = $this->find($clientId); |
|
| 26 | - $client->tokens()->update(['revoked' => true]); |
|
| 27 | - $this->save(['id'=> $clientId, 'revoked' => true]); |
|
| 28 | - } |
|
| 17 | + /** |
|
| 18 | + * Revoke the given client. |
|
| 19 | + * |
|
| 20 | + * @param integer $clientId |
|
| 21 | + * @return void |
|
| 22 | + */ |
|
| 23 | + public function revoke($clientId) |
|
| 24 | + { |
|
| 25 | + $client = $this->find($clientId); |
|
| 26 | + $client->tokens()->update(['revoked' => true]); |
|
| 27 | + $this->save(['id'=> $clientId, 'revoked' => true]); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * Un revoke the given client. |
|
| 32 | - * |
|
| 33 | - * @param integer $clientId |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function unRevoke($clientId) |
|
| 37 | - { |
|
| 38 | - $this->save(['id'=> $clientId, 'revoked' => false]); |
|
| 39 | - } |
|
| 30 | + /** |
|
| 31 | + * Un revoke the given client. |
|
| 32 | + * |
|
| 33 | + * @param integer $clientId |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function unRevoke($clientId) |
|
| 37 | + { |
|
| 38 | + $this->save(['id'=> $clientId, 'revoked' => false]); |
|
| 39 | + } |
|
| 40 | 40 | } |
@@ -2,67 +2,67 @@ |
||
| 2 | 2 | |
| 3 | 3 | class Media |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * Upload the given image. |
|
| 7 | - * |
|
| 8 | - * @param object $image |
|
| 9 | - * @param string $dir |
|
| 10 | - * @return string |
|
| 11 | - */ |
|
| 12 | - public function uploadImage($image, $dir) |
|
| 13 | - { |
|
| 14 | - $response = []; |
|
| 15 | - $image = $image; |
|
| 16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
| 17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 5 | + /** |
|
| 6 | + * Upload the given image. |
|
| 7 | + * |
|
| 8 | + * @param object $image |
|
| 9 | + * @param string $dir |
|
| 10 | + * @return string |
|
| 11 | + */ |
|
| 12 | + public function uploadImage($image, $dir) |
|
| 13 | + { |
|
| 14 | + $response = []; |
|
| 15 | + $image = $image; |
|
| 16 | + $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
| 17 | + $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 18 | 18 | |
| 19 | - ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
| 20 | - $image->move($destinationPath, $imageName); |
|
| 19 | + ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
| 20 | + $image->move($destinationPath, $imageName); |
|
| 21 | 21 | |
| 22 | - return url($destinationPath . $imageName); |
|
| 23 | - } |
|
| 22 | + return url($destinationPath . $imageName); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | - /** |
|
| 26 | - * Upload the given image. |
|
| 27 | - * |
|
| 28 | - * @param object $image |
|
| 29 | - * @param string $dir |
|
| 30 | - * @return string |
|
| 31 | - */ |
|
| 32 | - public function uploadImageBas64($image, $dir) |
|
| 33 | - { |
|
| 34 | - if (! strlen($image)) |
|
| 35 | - { |
|
| 36 | - return null; |
|
| 37 | - } |
|
| 25 | + /** |
|
| 26 | + * Upload the given image. |
|
| 27 | + * |
|
| 28 | + * @param object $image |
|
| 29 | + * @param string $dir |
|
| 30 | + * @return string |
|
| 31 | + */ |
|
| 32 | + public function uploadImageBas64($image, $dir) |
|
| 33 | + { |
|
| 34 | + if (! strlen($image)) |
|
| 35 | + { |
|
| 36 | + return null; |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | - $response = []; |
|
| 40 | - $image = $image; |
|
| 41 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
| 42 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 39 | + $response = []; |
|
| 40 | + $image = $image; |
|
| 41 | + $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
| 42 | + $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 43 | 43 | |
| 44 | - ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
| 44 | + ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
|
| 45 | 45 | |
| 46 | - $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
| 47 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
| 46 | + $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
|
| 47 | + $image = \Image::make($base)->save($destinationPath . $imageName); |
|
| 48 | 48 | |
| 49 | - return url($destinationPath . $imageName); |
|
| 50 | - } |
|
| 49 | + return url($destinationPath . $imageName); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - /** |
|
| 53 | - * Delete the given image. |
|
| 54 | - * |
|
| 55 | - * @param object $path |
|
| 56 | - * @param string $dir |
|
| 57 | - * @return void |
|
| 58 | - */ |
|
| 59 | - public function deleteImage($path, $dir) |
|
| 60 | - { |
|
| 61 | - $arr = explode('/', $path); |
|
| 62 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
| 63 | - if (\File::exists($path)) |
|
| 64 | - { |
|
| 65 | - \File::delete($path); |
|
| 66 | - } |
|
| 67 | - } |
|
| 52 | + /** |
|
| 53 | + * Delete the given image. |
|
| 54 | + * |
|
| 55 | + * @param object $path |
|
| 56 | + * @param string $dir |
|
| 57 | + * @return void |
|
| 58 | + */ |
|
| 59 | + public function deleteImage($path, $dir) |
|
| 60 | + { |
|
| 61 | + $arr = explode('/', $path); |
|
| 62 | + $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
| 63 | + if (\File::exists($path)) |
|
| 64 | + { |
|
| 65 | + \File::delete($path); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | 68 | } |
@@ -13,13 +13,13 @@ discard block |
||
| 13 | 13 | { |
| 14 | 14 | $response = []; |
| 15 | 15 | $image = $image; |
| 16 | - $imageName = str_slug('image' . uniqid() . time() . '_' . $image->getClientOriginalName()); |
|
| 17 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 16 | + $imageName = str_slug('image'.uniqid().time().'_'.$image->getClientOriginalName()); |
|
| 17 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
| 18 | 18 | |
| 19 | 19 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
| 20 | 20 | $image->move($destinationPath, $imageName); |
| 21 | 21 | |
| 22 | - return url($destinationPath . $imageName); |
|
| 22 | + return url($destinationPath.$imageName); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | /** |
@@ -31,22 +31,22 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public function uploadImageBas64($image, $dir) |
| 33 | 33 | { |
| 34 | - if (! strlen($image)) |
|
| 34 | + if ( ! strlen($image)) |
|
| 35 | 35 | { |
| 36 | 36 | return null; |
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | $response = []; |
| 40 | 40 | $image = $image; |
| 41 | - $imageName = 'image' . uniqid() . time() . '.jpg'; |
|
| 42 | - $destinationPath = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR; |
|
| 41 | + $imageName = 'image'.uniqid().time().'.jpg'; |
|
| 42 | + $destinationPath = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR; |
|
| 43 | 43 | |
| 44 | 44 | ! file_exists($destinationPath) ? \File::makeDirectory($destinationPath) : false; |
| 45 | 45 | |
| 46 | 46 | $base = base64_decode(preg_replace('#^data:image/\w+;base64,#i', '', $image)); |
| 47 | - $image = \Image::make($base)->save($destinationPath . $imageName); |
|
| 47 | + $image = \Image::make($base)->save($destinationPath.$imageName); |
|
| 48 | 48 | |
| 49 | - return url($destinationPath . $imageName); |
|
| 49 | + return url($destinationPath.$imageName); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | public function deleteImage($path, $dir) |
| 60 | 60 | { |
| 61 | 61 | $arr = explode('/', $path); |
| 62 | - $path = 'media' . DIRECTORY_SEPARATOR . $dir . DIRECTORY_SEPARATOR . end($arr); |
|
| 62 | + $path = 'media'.DIRECTORY_SEPARATOR.$dir.DIRECTORY_SEPARATOR.end($arr); |
|
| 63 | 63 | if (\File::exists($path)) |
| 64 | 64 | { |
| 65 | 65 | \File::delete($path); |
@@ -8,72 +8,72 @@ |
||
| 8 | 8 | class RouteServiceProvider extends ServiceProvider |
| 9 | 9 | { |
| 10 | 10 | /** |
| 11 | - * This namespace is applied to your controller routes. |
|
| 12 | - * |
|
| 13 | - * In addition, it is set as the URL generator's root namespace. |
|
| 14 | - * |
|
| 15 | - * @var string |
|
| 16 | - */ |
|
| 17 | - protected $namespace = 'App\Modules\Core\Http\Controllers'; |
|
| 11 | + * This namespace is applied to your controller routes. |
|
| 12 | + * |
|
| 13 | + * In addition, it is set as the URL generator's root namespace. |
|
| 14 | + * |
|
| 15 | + * @var string |
|
| 16 | + */ |
|
| 17 | + protected $namespace = 'App\Modules\Core\Http\Controllers'; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * Define your route model bindings, pattern filters, etc. |
|
| 21 | - * |
|
| 22 | - * @return void |
|
| 23 | - */ |
|
| 24 | - public function boot() |
|
| 25 | - { |
|
| 26 | - // |
|
| 19 | + /** |
|
| 20 | + * Define your route model bindings, pattern filters, etc. |
|
| 21 | + * |
|
| 22 | + * @return void |
|
| 23 | + */ |
|
| 24 | + public function boot() |
|
| 25 | + { |
|
| 26 | + // |
|
| 27 | 27 | |
| 28 | - parent::boot(); |
|
| 29 | - } |
|
| 28 | + parent::boot(); |
|
| 29 | + } |
|
| 30 | 30 | |
| 31 | - /** |
|
| 32 | - * Define the routes for the module. |
|
| 33 | - * |
|
| 34 | - * @return void |
|
| 35 | - */ |
|
| 36 | - public function map() |
|
| 37 | - { |
|
| 38 | - $this->mapWebRoutes(); |
|
| 31 | + /** |
|
| 32 | + * Define the routes for the module. |
|
| 33 | + * |
|
| 34 | + * @return void |
|
| 35 | + */ |
|
| 36 | + public function map() |
|
| 37 | + { |
|
| 38 | + $this->mapWebRoutes(); |
|
| 39 | 39 | |
| 40 | - $this->mapApiRoutes(); |
|
| 40 | + $this->mapApiRoutes(); |
|
| 41 | 41 | |
| 42 | - // |
|
| 43 | - } |
|
| 42 | + // |
|
| 43 | + } |
|
| 44 | 44 | |
| 45 | - /** |
|
| 46 | - * Define the "web" routes for the module. |
|
| 47 | - * |
|
| 48 | - * These routes all receive session state, CSRF protection, etc. |
|
| 49 | - * |
|
| 50 | - * @return void |
|
| 51 | - */ |
|
| 52 | - protected function mapWebRoutes() |
|
| 53 | - { |
|
| 54 | - Route::group([ |
|
| 55 | - 'middleware' => 'web', |
|
| 56 | - 'namespace' => $this->namespace, |
|
| 57 | - ], function ($router) { |
|
| 58 | - require module_path('core', 'Routes/web.php'); |
|
| 59 | - }); |
|
| 60 | - } |
|
| 45 | + /** |
|
| 46 | + * Define the "web" routes for the module. |
|
| 47 | + * |
|
| 48 | + * These routes all receive session state, CSRF protection, etc. |
|
| 49 | + * |
|
| 50 | + * @return void |
|
| 51 | + */ |
|
| 52 | + protected function mapWebRoutes() |
|
| 53 | + { |
|
| 54 | + Route::group([ |
|
| 55 | + 'middleware' => 'web', |
|
| 56 | + 'namespace' => $this->namespace, |
|
| 57 | + ], function ($router) { |
|
| 58 | + require module_path('core', 'Routes/web.php'); |
|
| 59 | + }); |
|
| 60 | + } |
|
| 61 | 61 | |
| 62 | - /** |
|
| 63 | - * Define the "api" routes for the module. |
|
| 64 | - * |
|
| 65 | - * These routes are typically stateless. |
|
| 66 | - * |
|
| 67 | - * @return void |
|
| 68 | - */ |
|
| 69 | - protected function mapApiRoutes() |
|
| 70 | - { |
|
| 71 | - Route::group([ |
|
| 72 | - 'middleware' => 'api', |
|
| 73 | - 'namespace' => $this->namespace, |
|
| 74 | - 'prefix' => 'api', |
|
| 75 | - ], function ($router) { |
|
| 76 | - require module_path('core', 'Routes/api.php'); |
|
| 77 | - }); |
|
| 78 | - } |
|
| 62 | + /** |
|
| 63 | + * Define the "api" routes for the module. |
|
| 64 | + * |
|
| 65 | + * These routes are typically stateless. |
|
| 66 | + * |
|
| 67 | + * @return void |
|
| 68 | + */ |
|
| 69 | + protected function mapApiRoutes() |
|
| 70 | + { |
|
| 71 | + Route::group([ |
|
| 72 | + 'middleware' => 'api', |
|
| 73 | + 'namespace' => $this->namespace, |
|
| 74 | + 'prefix' => 'api', |
|
| 75 | + ], function ($router) { |
|
| 76 | + require module_path('core', 'Routes/api.php'); |
|
| 77 | + }); |
|
| 78 | + } |
|
| 79 | 79 | } |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::group([ |
| 55 | 55 | 'middleware' => 'web', |
| 56 | 56 | 'namespace' => $this->namespace, |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require module_path('core', 'Routes/web.php'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'middleware' => 'api', |
| 73 | 73 | 'namespace' => $this->namespace, |
| 74 | 74 | 'prefix' => 'api', |
| 75 | - ], function ($router) { |
|
| 75 | + ], function($router) { |
|
| 76 | 76 | require module_path('core', 'Routes/api.php'); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -7,75 +7,75 @@ |
||
| 7 | 7 | class ModuleServiceProvider extends ServiceProvider |
| 8 | 8 | { |
| 9 | 9 | /** |
| 10 | - * Bootstrap the module services. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function boot() |
|
| 15 | - { |
|
| 16 | - $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
| 17 | - $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
| 10 | + * Bootstrap the module services. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function boot() |
|
| 15 | + { |
|
| 16 | + $this->loadTranslationsFrom(__DIR__.'/../Resources/Lang', 'core'); |
|
| 17 | + $this->loadViewsFrom(__DIR__.'/../Resources/Views', 'core'); |
|
| 18 | 18 | |
| 19 | - $factory = app('Illuminate\Database\Eloquent\Factory'); |
|
| 20 | - $factory->load(__DIR__.'/../Database/Factories'); |
|
| 21 | - } |
|
| 19 | + $factory = app('Illuminate\Database\Eloquent\Factory'); |
|
| 20 | + $factory->load(__DIR__.'/../Database/Factories'); |
|
| 21 | + } |
|
| 22 | 22 | |
| 23 | - /** |
|
| 24 | - * Register the module services. |
|
| 25 | - * |
|
| 26 | - * @return void |
|
| 27 | - */ |
|
| 28 | - public function register() |
|
| 29 | - { |
|
| 30 | - //Bind Core Facade to the IoC Container |
|
| 31 | - \App::bind('Core', function() |
|
| 32 | - { |
|
| 33 | - return new \App\Modules\Core\Core; |
|
| 34 | - }); |
|
| 23 | + /** |
|
| 24 | + * Register the module services. |
|
| 25 | + * |
|
| 26 | + * @return void |
|
| 27 | + */ |
|
| 28 | + public function register() |
|
| 29 | + { |
|
| 30 | + //Bind Core Facade to the IoC Container |
|
| 31 | + \App::bind('Core', function() |
|
| 32 | + { |
|
| 33 | + return new \App\Modules\Core\Core; |
|
| 34 | + }); |
|
| 35 | 35 | |
| 36 | - //Bind ErrorHandler Facade to the IoC Container |
|
| 37 | - \App::bind('ErrorHandler', function() |
|
| 38 | - { |
|
| 39 | - return new \App\Modules\Core\Utl\ErrorHandler; |
|
| 40 | - }); |
|
| 36 | + //Bind ErrorHandler Facade to the IoC Container |
|
| 37 | + \App::bind('ErrorHandler', function() |
|
| 38 | + { |
|
| 39 | + return new \App\Modules\Core\Utl\ErrorHandler; |
|
| 40 | + }); |
|
| 41 | 41 | |
| 42 | - //Bind CoreConfig Facade to the IoC Container |
|
| 43 | - \App::bind('CoreConfig', function() |
|
| 44 | - { |
|
| 45 | - return new \App\Modules\Core\Utl\CoreConfig; |
|
| 46 | - }); |
|
| 42 | + //Bind CoreConfig Facade to the IoC Container |
|
| 43 | + \App::bind('CoreConfig', function() |
|
| 44 | + { |
|
| 45 | + return new \App\Modules\Core\Utl\CoreConfig; |
|
| 46 | + }); |
|
| 47 | 47 | |
| 48 | - //Bind Mpgs Facade to the IoC Container |
|
| 49 | - \App::bind('Media', function() |
|
| 50 | - { |
|
| 51 | - return new \App\Modules\Core\Utl\Media; |
|
| 52 | - }); |
|
| 48 | + //Bind Mpgs Facade to the IoC Container |
|
| 49 | + \App::bind('Media', function() |
|
| 50 | + { |
|
| 51 | + return new \App\Modules\Core\Utl\Media; |
|
| 52 | + }); |
|
| 53 | 53 | |
| 54 | - \Validator::extend('base64image', function ($attribute, $value, $parameters, $validator) { |
|
| 55 | - $explode = explode(',', $value); |
|
| 56 | - $allow = ['png', 'jpg', 'svg']; |
|
| 57 | - $format = str_replace( |
|
| 58 | - [ |
|
| 59 | - 'data:image/', |
|
| 60 | - ';', |
|
| 61 | - 'base64', |
|
| 62 | - ], |
|
| 63 | - [ |
|
| 64 | - '', '', '', |
|
| 65 | - ], |
|
| 66 | - $explode[0] |
|
| 67 | - ); |
|
| 68 | - // check file format |
|
| 69 | - if (!in_array($format, $allow)) { |
|
| 70 | - return false; |
|
| 71 | - } |
|
| 72 | - // check base64 format |
|
| 73 | - if (!preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $explode[1])) { |
|
| 74 | - return false; |
|
| 75 | - } |
|
| 76 | - return true; |
|
| 77 | - }); |
|
| 54 | + \Validator::extend('base64image', function ($attribute, $value, $parameters, $validator) { |
|
| 55 | + $explode = explode(',', $value); |
|
| 56 | + $allow = ['png', 'jpg', 'svg']; |
|
| 57 | + $format = str_replace( |
|
| 58 | + [ |
|
| 59 | + 'data:image/', |
|
| 60 | + ';', |
|
| 61 | + 'base64', |
|
| 62 | + ], |
|
| 63 | + [ |
|
| 64 | + '', '', '', |
|
| 65 | + ], |
|
| 66 | + $explode[0] |
|
| 67 | + ); |
|
| 68 | + // check file format |
|
| 69 | + if (!in_array($format, $allow)) { |
|
| 70 | + return false; |
|
| 71 | + } |
|
| 72 | + // check base64 format |
|
| 73 | + if (!preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $explode[1])) { |
|
| 74 | + return false; |
|
| 75 | + } |
|
| 76 | + return true; |
|
| 77 | + }); |
|
| 78 | 78 | |
| 79 | - $this->app->register(RouteServiceProvider::class); |
|
| 80 | - } |
|
| 79 | + $this->app->register(RouteServiceProvider::class); |
|
| 80 | + } |
|
| 81 | 81 | } |
@@ -51,7 +51,7 @@ discard block |
||
| 51 | 51 | return new \App\Modules\Core\Utl\Media; |
| 52 | 52 | }); |
| 53 | 53 | |
| 54 | - \Validator::extend('base64image', function ($attribute, $value, $parameters, $validator) { |
|
| 54 | + \Validator::extend('base64image', function($attribute, $value, $parameters, $validator) { |
|
| 55 | 55 | $explode = explode(',', $value); |
| 56 | 56 | $allow = ['png', 'jpg', 'svg']; |
| 57 | 57 | $format = str_replace( |
@@ -66,11 +66,11 @@ discard block |
||
| 66 | 66 | $explode[0] |
| 67 | 67 | ); |
| 68 | 68 | // check file format |
| 69 | - if (!in_array($format, $allow)) { |
|
| 69 | + if ( ! in_array($format, $allow)) { |
|
| 70 | 70 | return false; |
| 71 | 71 | } |
| 72 | 72 | // check base64 format |
| 73 | - if (!preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $explode[1])) { |
|
| 73 | + if ( ! preg_match('%^[a-zA-Z0-9/+]*={0,2}$%', $explode[1])) { |
|
| 74 | 74 | return false; |
| 75 | 75 | } |
| 76 | 76 | return true; |
@@ -2,117 +2,117 @@ |
||
| 2 | 2 | |
| 3 | 3 | class CachingDecorator |
| 4 | 4 | { |
| 5 | - /** |
|
| 6 | - * The repo implementation. |
|
| 7 | - * |
|
| 8 | - * @var string |
|
| 9 | - */ |
|
| 10 | - public $repo; |
|
| 5 | + /** |
|
| 6 | + * The repo implementation. |
|
| 7 | + * |
|
| 8 | + * @var string |
|
| 9 | + */ |
|
| 10 | + public $repo; |
|
| 11 | 11 | |
| 12 | - /** |
|
| 13 | - * The cache implementation. |
|
| 14 | - * |
|
| 15 | - * @var object |
|
| 16 | - */ |
|
| 17 | - protected $cache; |
|
| 12 | + /** |
|
| 13 | + * The cache implementation. |
|
| 14 | + * |
|
| 15 | + * @var object |
|
| 16 | + */ |
|
| 17 | + protected $cache; |
|
| 18 | 18 | |
| 19 | - /** |
|
| 20 | - * The modelKey implementation. |
|
| 21 | - * |
|
| 22 | - * @var string |
|
| 23 | - */ |
|
| 24 | - public $modelKey; |
|
| 19 | + /** |
|
| 20 | + * The modelKey implementation. |
|
| 21 | + * |
|
| 22 | + * @var string |
|
| 23 | + */ |
|
| 24 | + public $modelKey; |
|
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * The model implementation. |
|
| 28 | - * |
|
| 29 | - * @var string |
|
| 30 | - */ |
|
| 31 | - public $model; |
|
| 26 | + /** |
|
| 27 | + * The model implementation. |
|
| 28 | + * |
|
| 29 | + * @var string |
|
| 30 | + */ |
|
| 31 | + public $model; |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * The modelClass implementation. |
|
| 35 | - * |
|
| 36 | - * @var string |
|
| 37 | - */ |
|
| 38 | - public $modelClass; |
|
| 33 | + /** |
|
| 34 | + * The modelClass implementation. |
|
| 35 | + * |
|
| 36 | + * @var string |
|
| 37 | + */ |
|
| 38 | + public $modelClass; |
|
| 39 | 39 | |
| 40 | - /** |
|
| 41 | - * The cacheConfig implementation. |
|
| 42 | - * |
|
| 43 | - * @var array |
|
| 44 | - */ |
|
| 45 | - public $cacheConfig; |
|
| 40 | + /** |
|
| 41 | + * The cacheConfig implementation. |
|
| 42 | + * |
|
| 43 | + * @var array |
|
| 44 | + */ |
|
| 45 | + public $cacheConfig; |
|
| 46 | 46 | |
| 47 | - /** |
|
| 48 | - * The cacheTag implementation. |
|
| 49 | - * |
|
| 50 | - * @var string |
|
| 51 | - */ |
|
| 52 | - public $cacheTag; |
|
| 47 | + /** |
|
| 48 | + * The cacheTag implementation. |
|
| 49 | + * |
|
| 50 | + * @var string |
|
| 51 | + */ |
|
| 52 | + public $cacheTag; |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Create new CachingDecorator instance. |
|
| 56 | - */ |
|
| 57 | - public function __construct($repo, $cache) |
|
| 58 | - { |
|
| 59 | - $this->repo = $repo; |
|
| 60 | - $this->cache = $cache; |
|
| 61 | - $this->model = $this->repo->model; |
|
| 62 | - $this->modelClass = get_class($this->model); |
|
| 63 | - $repoClass = explode('\\', get_class($this->repo)); |
|
| 64 | - $repoName = end($repoClass); |
|
| 65 | - $this->cacheTag = str_plural(lcfirst(substr($repoName, 0, strpos($repoName, 'Repository')))); |
|
| 66 | - } |
|
| 54 | + /** |
|
| 55 | + * Create new CachingDecorator instance. |
|
| 56 | + */ |
|
| 57 | + public function __construct($repo, $cache) |
|
| 58 | + { |
|
| 59 | + $this->repo = $repo; |
|
| 60 | + $this->cache = $cache; |
|
| 61 | + $this->model = $this->repo->model; |
|
| 62 | + $this->modelClass = get_class($this->model); |
|
| 63 | + $repoClass = explode('\\', get_class($this->repo)); |
|
| 64 | + $repoName = end($repoClass); |
|
| 65 | + $this->cacheTag = str_plural(lcfirst(substr($repoName, 0, strpos($repoName, 'Repository')))); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - /** |
|
| 69 | - * Handle the cache mechanism for the called method |
|
| 70 | - * based the configurations. |
|
| 71 | - * |
|
| 72 | - * @param string $name the called method name |
|
| 73 | - * @param array $arguments the method arguments |
|
| 74 | - * @return object |
|
| 75 | - */ |
|
| 76 | - public function __call($name, $arguments) |
|
| 77 | - { |
|
| 78 | - $this->setCacheConfig($name); |
|
| 68 | + /** |
|
| 69 | + * Handle the cache mechanism for the called method |
|
| 70 | + * based the configurations. |
|
| 71 | + * |
|
| 72 | + * @param string $name the called method name |
|
| 73 | + * @param array $arguments the method arguments |
|
| 74 | + * @return object |
|
| 75 | + */ |
|
| 76 | + public function __call($name, $arguments) |
|
| 77 | + { |
|
| 78 | + $this->setCacheConfig($name); |
|
| 79 | 79 | |
| 80 | - if ($this->cacheConfig && $this->cacheConfig == 'cache') |
|
| 81 | - { |
|
| 82 | - $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 83 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 84 | - return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
| 85 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 86 | - }); |
|
| 87 | - } |
|
| 88 | - else if ($this->cacheConfig) |
|
| 89 | - { |
|
| 90 | - $this->cache->tags($this->cacheConfig)->flush(); |
|
| 91 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 92 | - } |
|
| 80 | + if ($this->cacheConfig && $this->cacheConfig == 'cache') |
|
| 81 | + { |
|
| 82 | + $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
|
| 83 | + $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 84 | + return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
|
| 85 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 86 | + }); |
|
| 87 | + } |
|
| 88 | + else if ($this->cacheConfig) |
|
| 89 | + { |
|
| 90 | + $this->cache->tags($this->cacheConfig)->flush(); |
|
| 91 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 92 | + } |
|
| 93 | 93 | |
| 94 | - return call_user_func_array([$this->repo, $name], $arguments); |
|
| 95 | - } |
|
| 94 | + return call_user_func_array([$this->repo, $name], $arguments); |
|
| 95 | + } |
|
| 96 | 96 | |
| 97 | - /** |
|
| 98 | - * Set cache config based on the called method. |
|
| 99 | - * |
|
| 100 | - * @param string $name |
|
| 101 | - * @return void |
|
| 102 | - */ |
|
| 103 | - private function setCacheConfig($name) |
|
| 104 | - { |
|
| 105 | - $config = \CoreConfig::getConfig(); |
|
| 106 | - $cacheConfig = array_key_exists($this->cacheTag, $config['cacheConfig']) ? $config['cacheConfig'][$this->cacheTag] : false; |
|
| 107 | - $this->cacheConfig = false; |
|
| 97 | + /** |
|
| 98 | + * Set cache config based on the called method. |
|
| 99 | + * |
|
| 100 | + * @param string $name |
|
| 101 | + * @return void |
|
| 102 | + */ |
|
| 103 | + private function setCacheConfig($name) |
|
| 104 | + { |
|
| 105 | + $config = \CoreConfig::getConfig(); |
|
| 106 | + $cacheConfig = array_key_exists($this->cacheTag, $config['cacheConfig']) ? $config['cacheConfig'][$this->cacheTag] : false; |
|
| 107 | + $this->cacheConfig = false; |
|
| 108 | 108 | |
| 109 | - if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
|
| 110 | - { |
|
| 111 | - $this->cacheConfig = 'cache'; |
|
| 112 | - } |
|
| 113 | - else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 114 | - { |
|
| 115 | - $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 116 | - } |
|
| 117 | - } |
|
| 109 | + if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
|
| 110 | + { |
|
| 111 | + $this->cacheConfig = 'cache'; |
|
| 112 | + } |
|
| 113 | + else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 114 | + { |
|
| 115 | + $this->cacheConfig = $cacheConfig['clear'][$name]; |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | 118 | } |
| 119 | 119 | \ No newline at end of file |
@@ -64,7 +64,7 @@ |
||
| 64 | 64 | if ($this->cacheConfig && $this->cacheConfig == 'cache') |
| 65 | 65 | { |
| 66 | 66 | $page = \Request::get('page') !== null ? \Request::get('page') : '1'; |
| 67 | - $cacheKey = $name . $page . \Session::get('locale') . serialize($arguments); |
|
| 67 | + $cacheKey = $name.$page.\Session::get('locale').serialize($arguments); |
|
| 68 | 68 | return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
| 69 | 69 | return call_user_func_array([$this->repo, $name], $arguments); |
| 70 | 70 | }); |
@@ -68,8 +68,7 @@ discard block |
||
| 68 | 68 | return $this->cache->tags([$this->cacheTag])->rememberForever($cacheKey, function() use ($arguments, $name) { |
| 69 | 69 | return call_user_func_array([$this->repo, $name], $arguments); |
| 70 | 70 | }); |
| 71 | - } |
|
| 72 | - else if ($this->cacheConfig) |
|
| 71 | + } else if ($this->cacheConfig) |
|
| 73 | 72 | { |
| 74 | 73 | $this->cache->tags($this->cacheConfig)->flush(); |
| 75 | 74 | return call_user_func_array([$this->repo, $name], $arguments); |
@@ -93,8 +92,7 @@ discard block |
||
| 93 | 92 | if ($cacheConfig && in_array($name, $cacheConfig['cache'])) |
| 94 | 93 | { |
| 95 | 94 | $this->cacheConfig = 'cache'; |
| 96 | - } |
|
| 97 | - else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 95 | + } else if ($cacheConfig && isset($cacheConfig['clear'][$name])) |
|
| 98 | 96 | { |
| 99 | 97 | $this->cacheConfig = $cacheConfig['clear'][$name]; |
| 100 | 98 | } |