aleahy's avatar

aleahy wrote a reply+100 XP

1w ago

Issue: command fails when i run php artisan schedule:run

Make sure you have defined the signature correctly for the console command:

protected $signature = 'xxxxx:xxxxx';

The part before the colon is the namespace the error message is talking about.

So if your signature was app:test, then app would be the namespace.

If you defined your signature as just xxxxx then it would be expecting the command to just be xxxxx.

aleahy's avatar

aleahy wrote a reply+100 XP

1w ago

button/link to copy text to clipboard

The most likely reason you can't get it to work on it locally is that the navigator.clipboard requires https to work.

Get herd to issue a local ssl cert by running herd secure from the cli.

Then you should be able to debug locally in peace.

aleahy's avatar

aleahy wrote a reply+100 XP

1mo ago

InertiaJS and Security Headers ?

I think what @jsanwo64 was suggesting was that any scripts tags in your vue components could reference the nonce from the window variable.

<template>
  <script :nonce="nonceValue">
    console.log('Safe inline script');
  </script>
</template>

<script setup>
const nonceValue = window. __CSP_NONCE__;
</script>

But that is assuming you have access to whatever is injecting the script.

Have you made sure the issue still exists when you run npm run build? All the vue stuff should be compiled by vite and it should put the nonce on the script for that....

aleahy's avatar

aleahy wrote a reply+100 XP

2mos ago

InertiaJS and Security Headers ?

In addition to what you've done, you need to tell Vite to add the nonce in the middleware via Vite::useCspNonce().

This is from the laravel docs:

        Vite::useCspNonce();
 
        return $next($request)->withHeaders([
            'Content-Security-Policy' => "script-src 'nonce-".Vite::cspNonce()."'",
        ]);

For convenience, it's also worth using Spatie's package: https://github.com/spatie/laravel-csp

aleahy's avatar

aleahy wrote a reply+100 XP

2mos ago

Eloquent eager loading

Call ->setAppends([]) on the instance and it won't go and get the appended properties when hydrating the model for the front end.