Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here

pelican-dev/panel

1722 stars
2 code files
View pelican-dev/panel on GitHub

app/Traits/Services/HasUserLevels.php

Open in GitHub
use App\Models\User;
 
trait HasUserLevels
{
private int $userLevel = User::USER_LEVEL_USER;
 
public function setUserLevel(int $level): self
{
$this->userLevel = $level;
 
return $this;
}
 
public function getUserLevel(): int
{
return $this->userLevel;
}
 
public function isUserLevel(int $level): bool
{
return $this->getUserLevel() === $level;
}
}

app/Services/Servers/StartupModificationService.php

Open in GitHub
use App\Models\Server;
use App\Traits\Services\HasUserLevels;
 
class StartupModificationService
{
use HasUserLevels;
 
// ...
 
public function handle(Server $server, array $data): Server
{
return $this->connection->transaction(function () use ($server, $data) {
// ...
 
if ($this->isUserLevel(User::USER_LEVEL_ADMIN)) {
$this->updateAdministrativeSettings($data, $server);
}
 
return $server->fresh();
});
}
 
// ...
}

We'd Love Your Feedback

Tell us what you like or what we can improve

Feel free to share anything you like or dislike about this page or the platform in general.