RamzyVirani/laravel-boilerplate

View on GitHub

Showing 93 of 93 total issues

Method run has 1276 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function run()
    {
        DB::table('locales')->insert([
            [
                'code'        => 'en',
Severity: Major
Found in database/seeds/LocalesSeeder.php - About 6 days to fix

    File LocalesSeeder.php has 1286 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    use Carbon\Carbon;
    use Illuminate\Database\Seeder;
    use Illuminate\Support\Facades\DB;
    Severity: Major
    Found in database/seeds/LocalesSeeder.php - About 3 days to fix

      File step1.blade.php has 763 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      @push('scripts')
          <script src="{{ asset('public/js/admin/module/step1.js') }}"></script>
          <script src="{{ asset('public/js/admin/pluralize.js') }}"></script>
      @endpush
      <div class="tab-pane active" id="tab_1">
      Severity: Major
      Found in resources/views/admin/module/step1.blade.php - About 1 day to fix

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers\Api;
        
        use App\Http\Requests\Api\CreateRoleApiRequest;
        Severity: Major
        Found in app/Http/Controllers/Api/RoleAPIController.php and 1 other location - About 1 day to fix
        app/Http/Controllers/Api/NotificationAPIController.php on lines 1..345

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 364.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers\Api;
        
        use App\Http\Requests\Api\CreateNotificationAPIRequest;
        Severity: Major
        Found in app/Http/Controllers/Api/NotificationAPIController.php and 1 other location - About 1 day to fix
        app/Http/Controllers/Api/RoleAPIController.php on lines 1..337

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 364.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers\Api;
        
        use App\Http\Requests\Api\CreateSettingAPIRequest;
        Severity: Major
        Found in app/Http/Controllers/Api/SettingAPIController.php and 3 other locations - About 1 day to fix
        app/Http/Controllers/Api/ContactUsAPIController.php on lines 1..339
        app/Http/Controllers/Api/EmailTemplateAPIController.php on lines 1..347
        app/Http/Controllers/Api/LanguageAPIController.php on lines 1..338

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 349.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers\Api;
        
        use App\Http\Requests\Api\CreateContactUsAPIRequest;
        Severity: Major
        Found in app/Http/Controllers/Api/ContactUsAPIController.php and 3 other locations - About 1 day to fix
        app/Http/Controllers/Api/EmailTemplateAPIController.php on lines 1..347
        app/Http/Controllers/Api/LanguageAPIController.php on lines 1..338
        app/Http/Controllers/Api/SettingAPIController.php on lines 1..347

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 349.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers\Api;
        
        use App\Http\Requests\Api\CreateEmailTemplateAPIRequest;
        Severity: Major
        Found in app/Http/Controllers/Api/EmailTemplateAPIController.php and 3 other locations - About 1 day to fix
        app/Http/Controllers/Api/ContactUsAPIController.php on lines 1..339
        app/Http/Controllers/Api/LanguageAPIController.php on lines 1..338
        app/Http/Controllers/Api/SettingAPIController.php on lines 1..347

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 349.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 4 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\Http\Controllers\Api;
        
        use App\Http\Requests\Api\CreateLanguageAPIRequest;
        Severity: Major
        Found in app/Http/Controllers/Api/LanguageAPIController.php and 3 other locations - About 1 day to fix
        app/Http/Controllers/Api/ContactUsAPIController.php on lines 1..339
        app/Http/Controllers/Api/EmailTemplateAPIController.php on lines 1..347
        app/Http/Controllers/Api/SettingAPIController.php on lines 1..347

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 349.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public function saveRecord($request)
            {
                $input = $request->only(['socialName', 'socialLink', 'logo', 'default_language', 'email', 'phone', 'latitude', 'longitude', 'playstore', 'appstore', 'social_links', 'force_update', 'app_version']);
        
                if (isset($input['socialLink']) && isset($input['socialName'])) {
        Severity: Major
        Found in app/Repositories/Admin/SettingRepository.php and 1 other location - About 1 day to fix
        app/Repositories/Admin/SettingRepository.php on lines 76..99

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 270.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

            public function updateRecord($request, $setting)
            {
                $input = $request->only(['socialName', 'socialLink', 'logo', 'default_language', 'email', 'phone', 'latitude', 'longitude', 'playstore', 'appstore', 'social_links', 'force_update', 'app_version']);
        
                if (isset($input['socialName']) && isset($input['socialLink'])) {
        Severity: Major
        Found in app/Repositories/Admin/SettingRepository.php and 1 other location - About 1 day to fix
        app/Repositories/Admin/SettingRepository.php on lines 45..69

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 270.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\DataTables\Admin;
        
        use App\Models\ContactUs;
        Severity: Major
        Found in app/DataTables/Admin/ContactUsDataTable.php and 1 other location - About 1 day to fix
        app/DataTables/Admin/NotificationDataTable.php on lines 1..95

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 247.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

        <?php
        
        namespace App\DataTables\Admin;
        
        use App\Models\Notification;
        Severity: Major
        Found in app/DataTables/Admin/NotificationDataTable.php and 1 other location - About 1 day to fix
        app/DataTables/Admin/ContactUsDataTable.php on lines 1..95

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 247.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        File step3.blade.php has 344 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        @push('css')
            <style>
                .table-form tbody tr td {
                    position: relative;
                }
        Severity: Minor
        Found in resources/views/admin/module/step3.blade.php - About 4 hrs to fix

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              $(document).on('click', '.table-form .btn-up', function () {
                  var tr = $(this).parent().parent();
                  var trPrev = tr.prev('tr');
                  if (trPrev.length != 0) {
          
          
          Severity: Major
          Found in public/js/admin/module/step3.js and 3 other locations - About 3 hrs to fix
          public/js/admin/module/step2.js on lines 41..48
          public/js/admin/module/step2.js on lines 50..57
          public/js/admin/module/step3.js on lines 41..49

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              $(document).on('click', '.table-form .btn-down', function () {
                  var tr = $(this).parent().parent();
                  var trPrev = tr.next('tr');
                  if (trPrev.length != 0) {
          
          
          Severity: Major
          Found in public/js/admin/module/step3.js and 3 other locations - About 3 hrs to fix
          public/js/admin/module/step2.js on lines 41..48
          public/js/admin/module/step2.js on lines 50..57
          public/js/admin/module/step3.js on lines 31..39

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              $(document).on('click', '.table-display .btn-up', function () {
                  var tr = $(this).parent().parent();
                  var trPrev = tr.prev('tr');
                  if (trPrev.length != 0) {
                      tr.prev('tr').before(tr.clone());
          Severity: Major
          Found in public/js/admin/module/step2.js and 3 other locations - About 3 hrs to fix
          public/js/admin/module/step2.js on lines 50..57
          public/js/admin/module/step3.js on lines 31..39
          public/js/admin/module/step3.js on lines 41..49

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 4 locations. Consider refactoring.
          Open

              $(document).on('click', '.table-display .btn-down', function () {
                  var tr = $(this).parent().parent();
                  var trPrev = tr.next('tr');
                  if (trPrev.length != 0) {
                      tr.next('tr').after(tr.clone());
          Severity: Major
          Found in public/js/admin/module/step2.js and 3 other locations - About 3 hrs to fix
          public/js/admin/module/step2.js on lines 41..48
          public/js/admin/module/step3.js on lines 31..39
          public/js/admin/module/step3.js on lines 41..49

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 113.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Function handle has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring.
          Open

              public function handle($request, Closure $next)
              {
                  $routeName      = str_replace([$request->route()->action['prefix'] . '.', 'store', 'update'], ['', 'create', 'edit'], $request->route()->action['as']);
                  $permissionName = ($routeName == "") ? "dashboard" : $routeName;
          
          
          Severity: Minor
          Found in app/Http/Middleware/CheckAdminPermission.php - About 3 hrs to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          File pluralize.js has 315 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          /* global define */
          
          (function (root, pluralize) {
              /* istanbul ignore else */
              if (typeof require === 'function' && typeof exports === 'object' && typeof module === 'object') {
          Severity: Minor
          Found in public/js/admin/pluralize.js - About 3 hrs to fix
            Severity
            Category
            Status
            Source
            Language