[L6] Break search functionality without breaking the entire app
This commit is contained in:
parent
c97461d602
commit
5b4a65a60c
6 changed files with 41 additions and 3 deletions
18
app/Extensions/Illuminate/Database/Eloquent/Builder.php
Normal file
18
app/Extensions/Illuminate/Database/Eloquent/Builder.php
Normal 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;
|
||||
}
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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
|
||||
|
|
13
app/Models/Traits/Searchable.php
Normal file
13
app/Models/Traits/Searchable.php
Normal 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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue