[L6] Break search functionality without breaking the entire app

This commit is contained in:
Dane Everitt 2019-09-04 21:21:07 -07:00
parent c97461d602
commit 5b4a65a60c
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 41 additions and 3 deletions

View file

@ -0,0 +1,18 @@
<?php
namespace Pterodactyl\Extensions\Illuminate\Database\Eloquent;
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
class Builder extends EloquentBuilder
{
/**
* Do nothing.
*
* @return $this
*/
public function search()
{
return $this;
}
}

View file

@ -3,10 +3,11 @@
namespace Pterodactyl\Models;
use Illuminate\Notifications\Notifiable;
use Pterodactyl\Models\Traits\Searchable;
class Node extends Validable
{
use Notifiable;
use Notifiable, Searchable;
/**
* The resource name for this model when it is transformed into an

View file

@ -2,8 +2,12 @@
namespace Pterodactyl\Models;
use Pterodactyl\Models\Traits\Searchable;
class Pack extends Validable
{
use Searchable;
/**
* The resource name for this model when it is transformed into an
* API representation using fractal.

View file

@ -4,6 +4,7 @@ namespace Pterodactyl\Models;
use Schema;
use Illuminate\Notifications\Notifiable;
use Pterodactyl\Models\Traits\Searchable;
use Znck\Eloquent\Traits\BelongsToThrough;
/**
@ -52,7 +53,7 @@ use Znck\Eloquent\Traits\BelongsToThrough;
*/
class Server extends Validable
{
use BelongsToThrough, Notifiable;
use BelongsToThrough, Notifiable, Searchable;
/**
* The resource name for this model when it is transformed into an

View file

@ -0,0 +1,13 @@
<?php
namespace Pterodactyl\Models\Traits;
use Pterodactyl\Extensions\Illuminate\Database\Eloquent\Builder;
trait Searchable
{
public function newEloquentBuilder($query)
{
return new Builder($query);
}
}

View file

@ -7,6 +7,7 @@ use Illuminate\Support\Collection;
use Illuminate\Validation\Rules\In;
use Illuminate\Auth\Authenticatable;
use Illuminate\Notifications\Notifiable;
use Pterodactyl\Models\Traits\Searchable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Pterodactyl\Traits\Helpers\AvailableLanguages;
use Illuminate\Foundation\Auth\Access\Authorizable;
@ -20,7 +21,7 @@ class User extends Validable implements
AuthorizableContract,
CanResetPasswordContract
{
use Authenticatable, Authorizable, AvailableLanguages, CanResetPassword, Notifiable;
use Authenticatable, Authorizable, AvailableLanguages, CanResetPassword, Notifiable, Searchable;
const USER_LEVEL_USER = 0;
const USER_LEVEL_ADMIN = 1;