first commit
This commit is contained in:
21
app/Admin/Controllers/Ajax/AreaController.php
Normal file
21
app/Admin/Controllers/Ajax/AreaController.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace App\Admin\Controllers\Ajax;
|
||||
|
||||
use App\Models\Area;
|
||||
use DB;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class AreaController
|
||||
{
|
||||
|
||||
public function children(Request $request)
|
||||
{
|
||||
$code = $request->get('q');
|
||||
|
||||
return Area::whereHas('parent', function ($q) use ($code) {
|
||||
$q->where('code', $code);
|
||||
})->get(['code as id', DB::raw('name as text')]);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user