You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
446 B
PHP
22 lines
446 B
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Api;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use App\Models\Location;
|
|
use Illuminate\Http\Request;
|
|
|
|
class LocationController extends Controller
|
|
{
|
|
public function index(Request $request)
|
|
{
|
|
$query = Location::orderBy('updated_at', 'desc');
|
|
|
|
if ($request->q != '') {
|
|
$query->where('name', 'ilike', "%$request->q%");
|
|
}
|
|
|
|
return $query->limit(100)->get();
|
|
}
|
|
}
|