File "ValidateTeamDeletion.php"
Full Path: /home/fundopuh/trader.fxex.org/vendor/laravel/jetstream/src/Actions/ValidateTeamDeletion.php
File size: 650 bytes
MIME-type: text/x-php
Charset: utf-8
<?php
namespace Laravel\Jetstream\Actions;
use Illuminate\Support\Facades\Gate;
use Illuminate\Validation\ValidationException;
class ValidateTeamDeletion
{
/**
* Validate that the team can be deleted by the given user.
*
* @param mixed $user
* @param mixed $team
* @return void
*/
public function validate($user, $team)
{
Gate::forUser($user)->authorize('delete', $team);
if ($team->personal_team) {
throw ValidationException::withMessages([
'team' => __('You may not delete your personal team.'),
])->errorBag('deleteTeam');
}
}
}