cleanup
This commit is contained in:
parent
1f8b34e684
commit
01b5ec80a6
|
@ -57,6 +57,7 @@ class NotificationController extends Controller
|
||||||
*
|
*
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return JsonResponse
|
* @return JsonResponse
|
||||||
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function send(Request $request)
|
public function send(Request $request)
|
||||||
{
|
{
|
||||||
|
@ -89,11 +90,11 @@ class NotificationController extends Controller
|
||||||
} else {
|
} else {
|
||||||
$userIds = explode(",", $data["users"]);
|
$userIds = explode(",", $data["users"]);
|
||||||
$users = User::query()
|
$users = User::query()
|
||||||
->whereIn("id", $userIds)
|
->whereIn("id", $userIds)
|
||||||
->orWhereHas('discordUser' , function (Builder $builder) use ($userIds) {
|
->orWhereHas('discordUser', function (Builder $builder) use ($userIds) {
|
||||||
$builder->whereIn('id' , $userIds);
|
$builder->whereIn('id', $userIds);
|
||||||
})
|
})
|
||||||
->get();
|
->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($users->count() == 0) {
|
if ($users->count() == 0) {
|
||||||
|
|
|
@ -14,7 +14,7 @@ use Spatie\QueryBuilder\QueryBuilder;
|
||||||
class ServerController extends Controller
|
class ServerController extends Controller
|
||||||
{
|
{
|
||||||
const ALLOWED_INCLUDES = ['product', 'user'];
|
const ALLOWED_INCLUDES = ['product', 'user'];
|
||||||
const ALLOWED_FILTERS = ['name', 'suspended', 'identifier', 'pterodactyl_id', 'user_id' , 'product_id'];
|
const ALLOWED_FILTERS = ['name', 'suspended', 'identifier', 'pterodactyl_id', 'user_id', 'product_id'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display a listing of the resource.
|
* Display a listing of the resource.
|
||||||
|
@ -31,9 +31,6 @@ class ServerController extends Controller
|
||||||
return $query->paginate($request->input('per_page') ?? 50);
|
return $query->paginate($request->input('per_page') ?? 50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display the specified resource.
|
* Display the specified resource.
|
||||||
*
|
*
|
||||||
|
@ -43,13 +40,12 @@ class ServerController extends Controller
|
||||||
public function show(Server $server)
|
public function show(Server $server)
|
||||||
{
|
{
|
||||||
$query = QueryBuilder::for(Server::class)
|
$query = QueryBuilder::for(Server::class)
|
||||||
->where('id' ,'=' , $server->id)
|
->where('id', '=', $server->id)
|
||||||
->allowedIncludes(self::ALLOWED_INCLUDES);
|
->allowedIncludes(self::ALLOWED_INCLUDES);
|
||||||
|
|
||||||
return $query->get();
|
return $query->get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove the specified resource from storage.
|
* Remove the specified resource from storage.
|
||||||
*
|
*
|
||||||
|
|
|
@ -13,7 +13,6 @@ use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Contracts\Routing\ResponseFactory;
|
use Illuminate\Contracts\Routing\ResponseFactory;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
use Illuminate\Http\Client\RequestException;
|
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Http\Response;
|
use Illuminate\Http\Response;
|
||||||
use Illuminate\Support\Facades\App;
|
use Illuminate\Support\Facades\App;
|
||||||
|
@ -166,7 +165,7 @@ class UserController extends Controller
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @throws RequestException
|
* @throws ValidationException
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3,7 +3,6 @@
|
||||||
namespace App\Http\Controllers\Api;
|
namespace App\Http\Controllers\Api;
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Server;
|
|
||||||
use App\Models\Voucher;
|
use App\Models\Voucher;
|
||||||
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
use Illuminate\Contracts\Pagination\LengthAwarePaginator;
|
||||||
use Illuminate\Database\Eloquent\Collection;
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
@ -69,7 +68,7 @@ class VoucherController extends Controller
|
||||||
public function show(int $id)
|
public function show(int $id)
|
||||||
{
|
{
|
||||||
$query = QueryBuilder::for(Voucher::class)
|
$query = QueryBuilder::for(Voucher::class)
|
||||||
->where('id' ,'=' , $id)
|
->where('id', '=', $id)
|
||||||
->allowedIncludes(self::ALLOWED_INCLUDES);
|
->allowedIncludes(self::ALLOWED_INCLUDES);
|
||||||
|
|
||||||
return $query->get();
|
return $query->get();
|
||||||
|
|
Loading…
Reference in a new issue