Advertisement
Guest User

Untitled

a guest
May 25th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2.  
  3. namespace App\Nova\Actions;
  4.  
  5. use Illuminate\Bus\Queueable;
  6. use Laravel\Nova\Actions\Action;
  7. use Illuminate\Support\Collection;
  8. use Laravel\Nova\Fields\ActionFields;
  9. use Illuminate\Queue\SerializesModels;
  10. use Illuminate\Queue\InteractsWithQueue;
  11. use Illuminate\Contracts\Queue\ShouldQueue;
  12.  
  13. class ImpersonateUser extends Action
  14. {
  15. use InteractsWithQueue, Queueable, SerializesModels;
  16.  
  17. /**
  18. * Perform the action on the given models.
  19. *
  20. * @param \Laravel\Nova\Fields\ActionFields $fields
  21. * @param \Illuminate\Support\Collection $models
  22. * @return mixed
  23. */
  24. public function handle(ActionFields $fields, Collection $models)
  25. {
  26. return Action::redirect(
  27. route('impersonate', $models[0])
  28. );
  29. }
  30.  
  31. /**
  32. * Get the fields available on the action.
  33. *
  34. * @return array
  35. */
  36. public function fields()
  37. {
  38. return [];
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement