eOSP2/app/Http/Controllers/DataController.php

28 lines
656 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
{
public function getVoivodeships()
{
$voivodeships = DB::table('wojewodztwa')->pluck("name","id");
return view('unit',compact('voivodeships'));
}
2019-10-01 20:03:20 +02:00
public function getCounties($id)
2019-09-25 18:47:19 +02:00
{
$counties = DB::table("powiaty")->where("wojewodztwo_id",$id)->pluck("name","id");
return json_encode($counties);
}
2019-10-01 20:03:20 +02:00
public function getCommunities($id)
2019-09-25 18:47:19 +02:00
{
$communities= DB::table("gminy")->where("powiat_id",$id)->pluck("name","id");
return json_encode($communities);
}
2019-10-01 20:03:20 +02:00
}