Data Docter dan Hospital dnegan Filter di dashboard
This commit is contained in:
@@ -15,12 +15,22 @@ class OrganizationController extends Controller
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index()
|
||||
public function index(Request $request)
|
||||
{
|
||||
$organizations = Organization::active()->hospital()->with('currentAddress')->paginate();
|
||||
$organizations = Organization::hospital()->with('currentAddress')
|
||||
->when($request->search ?? null, function ($query, $search) {
|
||||
$query->where('name', 'LIKE', '%' . $search . '%');
|
||||
})
|
||||
->paginate();
|
||||
return response()->json(Helper::paginateResources(OrganizationResource::collection($organizations)));
|
||||
}
|
||||
|
||||
public function searchOrganization(Request $request)
|
||||
{
|
||||
$organizations = Organization::hospital()->get();
|
||||
return response()->json(OrganizationResource::collection($organizations));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
|
||||
Reference in New Issue
Block a user