File: /home/eslinced-103/brise-edu.or.kr/app/Nova/Central/Actions/ImpersonateTenant.php
<?php
namespace App\Nova\Central\Actions;
use App\Models\Central\Tenant;
use Illuminate\Bus\Queueable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Support\Collection;
use Laravel\Nova\Actions\Action;
use Laravel\Nova\Fields\ActionFields;
use Laravel\Nova\Http\Requests\NovaRequest;
class ImpersonateTenant extends Action
{
use InteractsWithQueue, Queueable;
/**
* Perform the action on the given models.
*
* @return mixed
*/
public function handle(ActionFields $fields, Collection $models)
{
/** @var Tenant $tenant */
$tenant = $models[0];
return Action::redirect(
$tenant->impersonationUrl(1)
);
}
/**
* Get the fields available on the action.
*/
public function fields(NovaRequest $request): array
{
return [];
}
}