jamespavett

jamespavett

Member Since 6 years ago

0 organizations

Experience Points
0
follower
Lessons Completed
0
follow
Lessons Completed
13
stars
Best Reply Awards
5
repos

14 contributions in the last year

jamespavett Most Used Languages
jamespavett GitHub Stats

5 Pinned

⚡ A site containing all my university notes
⚡ Allows you to control the columns and filters shown on any Nova resource index
⚡ A simple Vue.js datepicker component. Supports disabling of dates, inline mode, translations
⚡ Dynamically create markdown tables
⚡ Automated script to download course for codewithmosh.com learning site
Jun
11
1 week ago
Activity icon
issue

jamespavett issue comment PHPOffice/PhpSpreadsheet

jamespavett
jamespavett

Setting password does not work

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new Spreadsheet();

// Setting password does not work
$spreadsheet->getSecurity()->setLockStructure(true)->setWorkbookPassword("123456");

$worksheet = $spreadsheet->getActiveSheet();
$spreadsheet->setActiveSheetIndex(0);

// Here is the business logic code ... ...

$writer = new Xlsx($spreadsheet);
$Path = 'test.xlsx';
$writer->save($Path);
// add code that show the issue here...

The generated file can be opened and modified at will.

jamespavett
jamespavett

Probably being ignorant but is this really that difficult functionality to add? To me an option to set the workbook password sounds like it would protect the whole document.

Excel itself offers this functionality out of the box, in a couple of clicks you can apply a password to a workbook to protect the whole document.

Currently I use the following JavaScript tool which allows a password to easily be applied to XLS documents: https://github.com/ankane/secure-spreadsheet

Activity icon
issue

jamespavett issue comment PHPOffice/PhpSpreadsheet

jamespavett
jamespavett

Setting password does not work

<?php

require __DIR__ . '/vendor/autoload.php';

// Create new Spreadsheet object
$spreadsheet = new Spreadsheet();

// Setting password does not work
$spreadsheet->getSecurity()->setLockStructure(true)->setWorkbookPassword("123456");

$worksheet = $spreadsheet->getActiveSheet();
$spreadsheet->setActiveSheetIndex(0);

// Here is the business logic code ... ...

$writer = new Xlsx($spreadsheet);
$Path = 'test.xlsx';
$writer->save($Path);
// add code that show the issue here...

The generated file can be opened and modified at will.

jamespavett
jamespavett

@oleibman I believe he means setting password for entire workbook with setWorkbookPassword not just a singular sheet.

Sheets seem to work fine. Workbook does not.

Activity icon
issue

jamespavett issue comment laravel/framework

jamespavett
jamespavett

schema:dump generating errors in command line

  • Laravel Version: 8.46.0
  • PHP Version: 7.4.3
  • Database Driver & Version: MySQL 8.0.21

Description:

Potentially same issue as #34078 that was mentioned to be fixed by commit d67be13 in a comment on PR #34140

I am unable to run the schema:dump command in my current Laravel install. When ran I get the follow errors below suggesting column-statistics=0 and set-gtid-purged=OFF are unknown variables. I know the MySqlSchemaState class was modified to prevent these issues, but I am unclear why they are still happening even though I am on the latest version.

image

image

Steps To Reproduce:

Run schema:dump on a fresh Laravel install using the aforementioned MySQL version.

Any help would be appreciated!

jamespavett
jamespavett

@driesvints I just updated my MySQL version to 8.0.25 and still get the same error?

Could the ticket please be reopened please.

Activity icon
issue

jamespavett issue comment laravel/framework

jamespavett
jamespavett

schema:dump generating errors in command line

  • Laravel Version: 8.46.0
  • PHP Version: 7.4.3
  • Database Driver & Version: MySQL 8.0.21

Description:

Potentially same issue as #34078 that was mentioned to be fixed by commit d67be13 in a comment on PR #34140

I am unable to run the schema:dump command in my current Laravel install. When ran I get the follow errors below suggesting column-statistics=0 and set-gtid-purged=OFF are unknown variables. I know the MySqlSchemaState class was modified to prevent these issues, but I am unclear why they are still happening even though I am on the latest version.

image

image

Steps To Reproduce:

Run schema:dump on a fresh Laravel install using the aforementioned MySQL version.

Any help would be appreciated!

jamespavett
jamespavett

@driesvints is that actually an acceptable solution for this problem? Wasn't the commit introduced to fix this issue on earlier versions on MySQL?

Jun
10
1 week ago
Activity icon
issue

jamespavett issue laravel/framework

jamespavett
jamespavett

schema:dump generating errors in command line

  • Laravel Version: 8.46.0
  • PHP Version: 7.4.3
  • Database Driver & Version: MySQL 8.0.21

Description:

Potentially same issue as #34078 that was mentioned to be fixed by commit d67be13 in a comment on PR #34140

I am unable to run the schema:dump command in my current Laravel install. When ran I get the follow errors below suggesting column-statistics=0 and set-gtid-purged=OFF are unknown variables. I know the MySqlSchemaState class was modified to prevent these issues, but I am unclear why they are still happening even though I am on the latest version.

image

Steps To Reproduce:

Run schema:dump on a fresh Laravel install using the aforementioned MySQL version.

Any help would be appreciated!

May
20
1 month ago
Activity icon
issue

jamespavett issue comment spatie/nova-backup-tool

jamespavett
jamespavett

Multiple monitors with same disk but different names don't show backups

The dropdown shows the same disk two times but doesn't show any files as it doesn't use the name from the monitors config which it uses to retrieve the disks. I think that the name should be displayed and used to retrieve files as well.

Something like this code-snippet could work to instantiate all backup destinations.

$disk = 'backups';

$names = collect(config('backup.monitor_backups'))
  ->filter(fn(array $monitor) => in_array($disk, $monitor['disks']))
  ->pluck('name')
  ->unique()
  ->all();
Bildschirmfoto 2021-04-13 um 21 14 35 Bildschirmfoto 2021-04-13 um 21 13 48 Bildschirmfoto 2021-04-13 um 21 13 39
jamespavett
jamespavett

I have the exact same issue, would be good if the name could be shown in the frontend table alongside the disk

Apr
30
1 month ago
Activity icon
issue

jamespavett issue comment laravel/nova-issues

jamespavett
jamespavett

BelongsToMany dropdown not populating after editing relationship

  • Laravel Version: 8.40.0
  • Nova Version: 3.24.0
  • PHP Version: 7.4.3
  • Database Driver & Version: 8.0.22
  • Operating System and Version: Ubuntu 16.04
  • Browser type and version: Google Chrome

Description:

I have a BelongsToMany relationship shown within a resource, which acts on a pivot table with a couple of custom columns.

When modifying the relationship, as expected, the second field is an uneditable dropdown containing a list of the linked models (Called Individual Site Queries in below screenshot).

image

However when clicking on the Update & Continue Editing option, the page reloads but the dropdown is no longer populated with a value, instead it is showing the option to Choose a new option. If I use F5 to refresh the page the value gets populated as expected though.

image

image

I can still update / modify the relationship as normal, but it is an annoying visual bug for the end user.

Detailed steps to reproduce the issue on a fresh Nova installation:

In this instance I have a Many to Many relationship between two models, with them being links in Nova as follows:

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable(),
                ];
            }),
jamespavett
jamespavett

Okay cheers thanks for getting back to me

Activity icon
issue

jamespavett issue comment laravel/nova-issues

jamespavett
jamespavett

BelongsToMany dropdown not populating after editing relationship

  • Laravel Version: 8.40.0
  • Nova Version: 3.24.0
  • PHP Version: 7.4.3
  • Database Driver & Version: 8.0.22
  • Operating System and Version: Ubuntu 16.04
  • Browser type and version: Google Chrome

Description:

I have a BelongsToMany relationship shown within a resource, which acts on a pivot table with a couple of custom columns.

When modifying the relationship, as expected, the second field is an uneditable dropdown containing a list of the linked models (Called Individual Site Queries in below screenshot).

image

However when clicking on the Update & Continue Editing option, the page reloads but the dropdown is no longer populated with a value, instead it is showing the option to Choose a new option. If I use F5 to refresh the page the value gets populated as expected though.

image

image

I can still update / modify the relationship as normal, but it is an annoying visual bug for the end user.

Detailed steps to reproduce the issue on a fresh Nova installation:

In this instance I have a Many to Many relationship between two models, with them being links in Nova as follows:

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable(),
                ];
            }),
jamespavett
jamespavett

@davidhemphill is this not being considered a bug / defect? I can see that the label was assigned earlier, but then the issue has just been closed.

Apr
29
1 month ago
Activity icon
issue

jamespavett issue laravel/nova-issues

jamespavett
jamespavett

BelongsToMany dropdown not populating after editing relationship

  • Laravel Version: 8.40.0
  • Nova Version: 3.24.0
  • PHP Version: 7.4.3
  • Database Driver & Version: 8.0.22
  • Operating System and Version: Ubuntu 16.04
  • Browser type and version: Google Chrome

Description:

I have a BelongsToMany relationship shown within a resource, which acts on a pivot table with a couple of custom columns.

When modifying the relationship, as expected, the second field is an uneditable dropdown containing a list of the linked models (Called Individual Site Queries in below screenshot).

image

However when clicking on the Update & Continue Editing option, the page reloads but the dropdown is no longer populated with a value, instead it is showing the option to Choose a new option. If I use F5 to refresh the page the value gets populated as expected though.

image

image

I can still update / modify the relationship as normal, but it is an annoying visual bug for the end user.

Detailed steps to reproduce the issue on a fresh Nova installation:

In this instance I have a Many to Many relationship between two models, with them being links in Nova as follows:

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable(),
                ];
            }),
Activity icon
issue

jamespavett issue dillingham/nova-items-field

jamespavett
jamespavett

Doesn't work inside BelongsToMany field

Trying to use the Items field within a BelongtoMany field, and the inputted values aren't being passed in the request.

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Text::make('Query File', 'query_file')->hideWhenCreating()->readonly()->sortable(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable()->help('Does this query support Array injection via PHP variables?'),
                    Items::make('Headers', 'headers')->draggable(),
                    Code::make('SQL Query')->resolveUsing(function () {
                        return isset($this->pivot) && $this->pivot->query_file ? Storage::get($this->pivot->query_file) : null;
                    })->rules('required')->language('sql')->temporary(),

                ];
            }),

Have tried referencing column via sites.headers and leaving second parameter blank, but always get the same output. No error on frontend however field in database doesn't update. Works outside of BelongsToMany field though just fine.

Activity icon
issue

jamespavett issue dillingham/nova-items-field

jamespavett
jamespavett

Doesn't work inside BelongsToMany field

Trying to use the Items field within a BelongtoMany field, and the inputted values aren't being passed in the request.

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Text::make('Query File', 'query_file')->hideWhenCreating()->readonly()->sortable(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable()->help('Does this query support Array injection via PHP variables?'),
                    Items::make('Headers', 'headers')->draggable(),
                    Code::make('SQL Query')->resolveUsing(function () {
                        return isset($this->pivot) && $this->pivot->query_file ? Storage::get($this->pivot->query_file) : null;
                    })->rules('required')->language('sql')->temporary(),

                ];
            }),

Have tried referencing column via sites.headers and leaving second parameter blank, but always get the same output. No error on frontend however field in database doesn't update. Works outside of BelongsToMany field though just fine.

Activity icon
issue

jamespavett issue comment dillingham/nova-items-field

jamespavett
jamespavett

Doesn't work inside BelongsToMany field

Trying to use the Items field within a BelongtoMany field, and the inputted values aren't being passed in the request.

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Text::make('Query File', 'query_file')->hideWhenCreating()->readonly()->sortable(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable()->help('Does this query support Array injection via PHP variables?'),
                    Items::make('Headers', 'headers')->draggable(),
                    Code::make('SQL Query')->resolveUsing(function () {
                        return isset($this->pivot) && $this->pivot->query_file ? Storage::get($this->pivot->query_file) : null;
                    })->rules('required')->language('sql')->temporary(),

                ];
            }),

Have tried referencing column via sites.headers and leaving second parameter blank, but always get the same output. No error on frontend however field in database doesn't update. Works outside of BelongsToMany field though just fine.

jamespavett
jamespavett

My bad, released I wasn't including the property as part of my withPivot method options

public function sites()
    {
        return $this->belongsToMany(Site::class)->using(DatabaseQuerySite::class)->withTimestamps()->withPivot([
            'version', 'query_file', 'template_syntax', 'headers'
        ]);
    }
Activity icon
issue

jamespavett issue dillingham/nova-items-field

jamespavett
jamespavett

Doesn't work inside BelongsToMany field

Trying to use the Items field within a BelongtoMany field, and the inputted values aren't being passed in the request.

BelongsToMany::make('Individual Site Queries', 'sites', SiteResource::class)->fields(function () {
                return [
                    Text::make('Version', 'version')->sortable()->readonly(),
                    Text::make('Query File', 'query_file')->hideWhenCreating()->readonly()->sortable(),
                    Boolean::make('Template Syntax', 'template_syntax')->sortable()->help('Does this query support Array injection via PHP variables?'),
                    Items::make('Headers', 'headers')->draggable(),
                    Code::make('SQL Query')->resolveUsing(function () {
                        return isset($this->pivot) && $this->pivot->query_file ? Storage::get($this->pivot->query_file) : null;
                    })->rules('required')->language('sql')->temporary(),

                ];
            }),

Have tried referncing column via sites.headers and leaving second parameter blank, but always get the same output. No error on frontend however field in database doesn't update. Works outside of BelongsToMany field though just fine.

Apr
22
2 months ago
Apr
16
2 months ago
Activity icon
issue

jamespavett issue comment ankane/secure-spreadsheet

jamespavett
jamespavett

Unable to create encrypted file

When I try to create I get the following error.

internal/modules/cjs/loader.js:1216 throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js require() of ES modules is not supported. require() of /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js from /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/src/cli.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/package.json.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1216:13)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/src/cli.js:4:18)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14) {

code: 'ERR_REQUIRE_ESM' }

jamespavett
jamespavett

@ankane any idea why I would have only had this problem on one of my instances? I'm assuming one server was utilising old dependency version but would like to be sure.

Activity icon
issue

jamespavett issue comment ankane/secure-spreadsheet

jamespavett
jamespavett

Unable to create encrypted file

When I try to create I get the following error.

internal/modules/cjs/loader.js:1216 throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js require() of ES modules is not supported. require() of /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js from /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/src/cli.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/package.json.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1216:13)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/src/cli.js:4:18)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14) {

code: 'ERR_REQUIRE_ESM' }

jamespavett
jamespavett

Should add, I'm using the latest available version of the package (1.0.3).

Seems similar to #7 , as this also generated an empty 0kb file.

started
started time in 2 months ago
Activity icon
issue

jamespavett issue comment ankane/secure-spreadsheet

jamespavett
jamespavett

Unable to create encrypted file

When I try to create I get the following error.

internal/modules/cjs/loader.js:1216 throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js require() of ES modules is not supported. require() of /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js from /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/src/cli.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules. Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/package.json.

at Object.Module._extensions..js (internal/modules/cjs/loader.js:1216:13)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/root/.nvm/versions/node/v14.4.0/lib/node_modules/secure-spreadsheet/src/cli.js:4:18)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14) {

code: 'ERR_REQUIRE_ESM' }

jamespavett
jamespavett

Getting the exact same error but on Node.js v12.20.1. However only one one of our production servers, the other one is still working just fine. I have tried to compare them both and cannot see any clear differences, so I'm baffled.

Trying to run the following command:

cat 1609420126-.csv | secure-spreadsheet --password secret > output.xlsx

And getting the below output:

internal/modules/cjs/loader.js:1015
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /usr/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js
require() of ES modules is not supported.
require() of /usr/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/index.js from /usr/lib/node_modules/secure-spreadsheet/src/cli.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /usr/lib/node_modules/secure-spreadsheet/node_modules/get-stdin/package.json.

    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1015:13)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14)
    at Module.require (internal/modules/cjs/loader.js:887:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/usr/lib/node_modules/secure-spreadsheet/src/cli.js:4:18)
    at Module._compile (internal/modules/cjs/loader.js:999:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1027:10)
    at Module.load (internal/modules/cjs/loader.js:863:32)
    at Function.Module._load (internal/modules/cjs/loader.js:708:14) {
  code: 'ERR_REQUIRE_ESM'