1
0
forked from s421507/eOSP2
eOSP2/app/Http/Controllers/DataController.php

29 lines
671 B
PHP
Raw Normal View History

2019-09-25 18:47:19 +02:00
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use DB;
class DataController extends Controller
{
2019-09-30 19:19:32 +02:00
/*
2019-09-25 18:47:19 +02:00
public function getVoivodeships()
{
$voivodeships = DB::table('wojewodztwa')->pluck("name","id");
return view('unit',compact('voivodeships'));
}
2019-09-30 19:19:32 +02:00
*/
2019-09-25 18:47:19 +02:00
public function getCounties($id)
{
$counties = DB::table("powiaty")->where("wojewodztwo_id",$id)->pluck("name","id");
return json_encode($counties);
}
public function getCommunities($id)
{
$communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id");
return json_encode($communities);
}
}