Filter Startpage Apps
This commit is contained in:
parent
a41c747bcd
commit
d8a212b230
3 changed files with 13 additions and 0 deletions
|
@ -7,6 +7,7 @@ use App\Exceptions\NoPermissionException;
|
|||
use App\Exceptions\NotLoggedInException;
|
||||
use App\Exceptions\ResourceNotFound;
|
||||
use App\Models\User;
|
||||
use http\Env\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Laravel\Lumen\Routing\Controller as BaseController;
|
||||
use TaGeSo\APIResponse\Response;
|
||||
|
@ -50,4 +51,5 @@ class AccountController extends BaseController
|
|||
|
||||
return $response->withData(new \App\Http\Resources\API\User($user));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,6 +89,7 @@ class AppController extends BaseController
|
|||
|
||||
$this->validate($request, [
|
||||
'apiKey' => '',
|
||||
'startpage' => ''
|
||||
]);
|
||||
|
||||
$query = \App\Models\App::query();
|
||||
|
@ -97,6 +98,11 @@ class AppController extends BaseController
|
|||
$query->where("apiKey", "=", $request->input("apiKey"));
|
||||
}
|
||||
|
||||
if($request->input("webpage", false)) {
|
||||
$query->where("show_on_webpage", "=", 1);
|
||||
}
|
||||
|
||||
|
||||
$apps = $query->paginate(20);
|
||||
|
||||
$response->setPagination($apps->currentPage(), $apps->lastPage(), $apps->perPage());
|
||||
|
|
|
@ -509,6 +509,11 @@ paths:
|
|||
description: "Search an app based on the API-Key"
|
||||
required: false
|
||||
type: string
|
||||
- in: query
|
||||
name: webpage
|
||||
description: "Return Apps shown on the Startpage"
|
||||
required: false
|
||||
type: boolean
|
||||
responses:
|
||||
200:
|
||||
description: "List of Apps"
|
||||
|
|
Reference in a new issue