2017-07-08 19:07:51 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Pterodactyl\Repositories\Eloquent;
|
|
|
|
|
|
|
|
use Pterodactyl\Models\APIKey;
|
|
|
|
use Pterodactyl\Contracts\Repository\ApiKeyRepositoryInterface;
|
|
|
|
|
|
|
|
class ApiKeyRepository extends EloquentRepository implements ApiKeyRepositoryInterface
|
|
|
|
{
|
|
|
|
/**
|
2018-01-05 04:49:50 +00:00
|
|
|
* Return the model backing this repository.
|
|
|
|
*
|
|
|
|
* @return string
|
2017-07-08 19:07:51 +00:00
|
|
|
*/
|
|
|
|
public function model()
|
|
|
|
{
|
|
|
|
return APIKey::class;
|
|
|
|
}
|
2017-12-03 20:29:14 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Load permissions for a key onto the model.
|
|
|
|
*
|
|
|
|
* @param \Pterodactyl\Models\APIKey $model
|
|
|
|
* @param bool $refresh
|
2018-01-12 04:49:46 +00:00
|
|
|
* @deprecated
|
2017-12-03 20:29:14 +00:00
|
|
|
* @return \Pterodactyl\Models\APIKey
|
|
|
|
*/
|
|
|
|
public function loadPermissions(APIKey $model, bool $refresh = false): APIKey
|
|
|
|
{
|
|
|
|
if (! $model->relationLoaded('permissions') || $refresh) {
|
|
|
|
$model->load('permissions');
|
|
|
|
}
|
|
|
|
|
|
|
|
return $model;
|
|
|
|
}
|
2017-07-08 19:07:51 +00:00
|
|
|
}
|