OctopyID / LaraPersonate

Login as a different user quickly for Laravel
MIT License
295 stars 27 forks source link

No octane support? #26

Open zhaiyuxin103 opened 4 days ago

SupianIDz commented 4 days ago

hi @zhaiyuxin103, So far I have never tried in Octane, can you explain the problem of this package when using Octane?

zhaiyuxin103 commented 4 days ago

hi @zhaiyuxin103, So far I have never tried in Octane, can you explain the problem of this package when using Octane?

I did the following in a non-octant project and I could see the UI in the lower right corner but I did the same in an octane project and I couldn't see the UI.

composer require octopyid/laravel-impersonate
art vendor:publish --tag="impersonate"

use Octopy\Impersonate\Concerns\HasImpersonation;
use Illuminate\Foundation\Auth\User as Authenticatable;

class User extends Authenticatable
{
    use HasImpersonation;

    /**
     * @return string
     */
    public function getImpersonateDisplayText() : string
    {
        return $this->name;
    }

    /**
     * This following is useful for performing user searches through the interface,
     * You can use fields in relations freely using dot notation,
     * 
     * example: posts.title, department.name.   
     */
    public function getImpersonateSearchField() : array
    {
        return [
            'name', 'posts.title',
        ];
    }
}
zhaiyuxin103 commented 4 days ago

Thanks for your quick reply.

SupianIDz commented 4 days ago

@zhaiyuxin103

  1. Is the account logged in? The icon will appear when an account with impersonation permission has been authenticated.

  2. If it has been logged in but it still doesn't appear, please show the console log from the browser, there may be error information there.

zhaiyuxin103 commented 4 days ago
  1. I have logged in
  2. I have not defined the setImpersonateAuthorization method, by default all users can be impersonated
  3. there is no error in the console

image

SupianIDz commented 4 days ago

I have tried running this package with Laravel Octane & Swolee but it works fine. The only thing this package doesn't run is when APP_URL doesn't match the url of the server being run.

If you don't mind, can you give me your minimal version repository for reproduction, thank you @zhaiyuxin103.

Octane & Swolee

Screenshot 2024-11-20 at 12 59 26

Breeze

Screenshot 2024-11-20 at 12 59 10

Jetstream

Screenshot 2024-11-20 at 13 09 16