validateCsrfTokens - does not accept dynamic parameters #51005
Unanswered
devexchanger
asked this question in
Q&A
Replies: 2 comments
-
This happens because the |
Beta Was this translation helpful? Give feedback.
0 replies
-
For anyone who might come across this question, like I did. You can add the exception rules via the AppServiceProvider. <?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
public function boot(): void
{
\Illuminate\Foundation\Http\Middleware\VerifyCsrfToken::except([
'test/*',
config('project.path') // Should work here
]);
}
} At this point in the lifecycle the config function has been loaded. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Laravel Version
11.3
PHP Version
8.2
Database Driver & Version
mysql
Description
Is there no way to add dynamic paths to validateCsrfTokens?
They are very useful for work.
Now have to write everything manually.
For example, if the path to the administrator is created dynamically, have to manually change here
Steps To Reproduce
Beta Was this translation helpful? Give feedback.
All reactions