-
-
Save czemu/26386449cc366054162422e347a01f2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace App\Nova\Actions; | |
use Illuminate\Bus\Queueable; | |
use Illuminate\Contracts\Queue\ShouldQueue; | |
use Illuminate\Queue\InteractsWithQueue; | |
use Illuminate\Support\Collection; | |
use Laravel\Nova\Actions\Action; | |
use Laravel\Nova\Fields\ActionFields; | |
use Laravel\Nova\Fields\Text; | |
class BanUser extends Action | |
{ | |
use InteractsWithQueue, Queueable; | |
/** | |
* Perform the action on the given models. | |
* | |
* @param \Laravel\Nova\Fields\ActionFields $fields | |
* @param \Illuminate\Support\Collection $models | |
* @return mixed | |
*/ | |
public function handle(ActionFields $fields, Collection $models) | |
{ | |
foreach ($models as $model) | |
{ | |
$model->banAccount($fields->reason); | |
} | |
} | |
/** | |
* Get the fields available on the action. | |
* | |
* @return array | |
*/ | |
public function fields() | |
{ | |
return [ | |
Text::make('Reason') | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment