Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use new #95

Open
meredevelopment opened this issue Dec 6, 2022 · 0 comments
Open

How to use new #95

meredevelopment opened this issue Dec 6, 2022 · 0 comments

Comments

@meredevelopment
Copy link

I'm having difficulty using the newish LPL_MIDDLEWARE env var.

I need to inject some middleware called firetest before every request this package deals with. I can add it via the config like this and it works fine:

<?php

use Grosv\LaravelPasswordlessLogin\HandleAuthenticatedUsers;

return [
    'user_model' => env('LPL_USER_MODEL', 'App\User'),
    // etc etc 
    'middleware' => env('LPL_MIDDLEWARE', ['firetest', 'web', HandleAuthenticatedUsers::class]),
];

How would I add it in .env?

I've tried:

LPL_MIDDLEWARE="['firetest', 'web', HandleAuthenticatedUsers::class]" #result: Target class [['firetest', 'web', HandleAuthenticatedUsers] does not exist
LPL_MIDDLEWARE="['firetest', 'web', Grosv\LaravelPasswordlessLogin\HandleAuthenticatedUsers\HandleAuthenticatedUsers::class]" #result: White screen no visible errors.
LPL_MIDDLEWARE="['firetest', 'web', Grosv\LaravelPasswordlessLogin\HandleAuthenticatedUsers\HandleAuthenticatedUsers]" #result: White screen no visible errors.
LPL_MIDDLEWARE="['firetest', 'web']" #result: Target class [['firetest', 'web']] does not exist.
LPL_MIDDLEWARE="\['firetest', 'web'\]" #result: Target class [['firetest', 'web']] does not exist.

I'm thinking there's no way to define an array in .env without having it exploded or something to turn it into an array when it's retrieved, so is the LPL_MIDDLEWARE actually usable? I suppose if one only want's to define a single middleware it is. Any thoughts please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant