rector: arrrrr

This commit is contained in:
Andras Bacsai
2025-01-07 14:52:08 +01:00
parent c702ebff6d
commit 16c0cd10d8
349 changed files with 4204 additions and 3712 deletions

View File

@@ -4,6 +4,7 @@ namespace App\Livewire\Team;
use App\Enums\Role;
use App\Models\User;
use Exception;
use Illuminate\Support\Facades\Cache;
use Livewire\Component;
@@ -16,11 +17,11 @@ class Member extends Component
try {
if (Role::from(auth()->user()->role())->lt(Role::ADMIN)
|| Role::from($this->getMemberRole())->gt(auth()->user()->role())) {
throw new \Exception('You are not authorized to perform this action.');
throw new Exception('You are not authorized to perform this action.');
}
$this->member->teams()->updateExistingPivot(currentTeam()->id, ['role' => Role::ADMIN->value]);
$this->dispatch('reloadWindow');
} catch (\Exception $e) {
} catch (Exception $e) {
$this->dispatch('error', $e->getMessage());
}
}
@@ -30,11 +31,11 @@ class Member extends Component
try {
if (Role::from(auth()->user()->role())->lt(Role::OWNER)
|| Role::from($this->getMemberRole())->gt(auth()->user()->role())) {
throw new \Exception('You are not authorized to perform this action.');
throw new Exception('You are not authorized to perform this action.');
}
$this->member->teams()->updateExistingPivot(currentTeam()->id, ['role' => Role::OWNER->value]);
$this->dispatch('reloadWindow');
} catch (\Exception $e) {
} catch (Exception $e) {
$this->dispatch('error', $e->getMessage());
}
}
@@ -44,11 +45,11 @@ class Member extends Component
try {
if (Role::from(auth()->user()->role())->lt(Role::ADMIN)
|| Role::from($this->getMemberRole())->gt(auth()->user()->role())) {
throw new \Exception('You are not authorized to perform this action.');
throw new Exception('You are not authorized to perform this action.');
}
$this->member->teams()->updateExistingPivot(currentTeam()->id, ['role' => Role::MEMBER->value]);
$this->dispatch('reloadWindow');
} catch (\Exception $e) {
} catch (Exception $e) {
$this->dispatch('error', $e->getMessage());
}
}
@@ -58,7 +59,7 @@ class Member extends Component
try {
if (Role::from(auth()->user()->role())->lt(Role::ADMIN)
|| Role::from($this->getMemberRole())->gt(auth()->user()->role())) {
throw new \Exception('You are not authorized to perform this action.');
throw new Exception('You are not authorized to perform this action.');
}
$this->member->teams()->detach(currentTeam());
Cache::forget("team:{$this->member->id}");
@@ -66,7 +67,7 @@ class Member extends Component
return $this->member->teams()->first();
});
$this->dispatch('reloadWindow');
} catch (\Exception $e) {
} catch (Exception $e) {
$this->dispatch('error', $e->getMessage());
}
}