mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-24 14:03:16 +00:00
Update ApiController
This commit is contained in:
parent
4ad7fe05fc
commit
1632d295ef
1 changed files with 4 additions and 2 deletions
|
@ -81,11 +81,13 @@ class ApiController extends BaseApiController
|
||||||
|
|
||||||
public function composeLocationSearch(Request $request)
|
public function composeLocationSearch(Request $request)
|
||||||
{
|
{
|
||||||
|
abort_if(!Auth::check(), 403);
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'q' => 'required|string'
|
'q' => 'required|string'
|
||||||
]);
|
]);
|
||||||
|
$q = filter_var($request->input('q'), FILTER_SANITIZE_STRING);
|
||||||
$places = Place::where('name', 'like', '%' . $request->input('q') . '%')
|
$q = '%' . $q . '%';
|
||||||
|
$places = Place::where('name', 'like', $q)
|
||||||
->take(25)
|
->take(25)
|
||||||
->get()
|
->get()
|
||||||
->map(function($r) {
|
->map(function($r) {
|
||||||
|
|
Loading…
Reference in a new issue