Fix stupid query that makes me want to punch my monitor

This commit is contained in:
Matthew Penner 2020-04-10 13:47:08 -06:00
parent 07d19ad326
commit c46ece0d6b

View file

@ -21,6 +21,8 @@ abstract class SubuserRequest extends ClientApiRequest
* Authorize the request and ensure that a user is not trying to modify themselves. * Authorize the request and ensure that a user is not trying to modify themselves.
* *
* @return bool * @return bool
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
public function authorize(): bool public function authorize(): bool
{ {
@ -52,6 +54,8 @@ abstract class SubuserRequest extends ClientApiRequest
* by the user making the request. * by the user making the request.
* *
* @param array $permissions * @param array $permissions
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
protected function validatePermissionsCanBeAssigned(array $permissions) protected function validatePermissionsCanBeAssigned(array $permissions)
{ {
@ -78,6 +82,8 @@ abstract class SubuserRequest extends ClientApiRequest
* Returns the currently authenticated user's permissions. * Returns the currently authenticated user's permissions.
* *
* @return array * @return array
*
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
public function currentUserPermissions(): array public function currentUserPermissions(): array
{ {
@ -88,7 +94,7 @@ abstract class SubuserRequest extends ClientApiRequest
try { try {
$model = $repository->findFirstWhere([ $model = $repository->findFirstWhere([
['server_id', $this->route()->parameter('server')->id], ['server_id', $this->route()->parameter('server')->id],
['user_id' => $this->user()->id], ['user_id', $this->user()->id],
]); ]);
} catch (RecordNotFoundException $exception) { } catch (RecordNotFoundException $exception) {
return []; return [];
@ -109,6 +115,7 @@ abstract class SubuserRequest extends ClientApiRequest
* *
* @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException
* @throws \Illuminate\Database\Eloquent\ModelNotFoundException * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
* @throws \Illuminate\Contracts\Container\BindingResolutionException
*/ */
public function endpointSubuser() public function endpointSubuser()
{ {