Completed
Push — master ( a5413b...5eb04c )
by
unknown
10s
created

WilayahIndonesiaController::kecamatanindex()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 23
Code Lines 18

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 18
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 23
rs 9.0856
1
<?php namespace Bantenprov\WilayahIndonesia\Http\Controllers;
2
3
use App\Http\Controllers\Controller;
4
use Illuminate\Http\Request;
5
use Bantenprov\WilayahIndonesia\Facades\WilayahIndonesia;
6
use Bantenprov\WilayahIndonesia\Models\Provinsi;
7
use Laravolt\Indonesia\Indonesia;
8
use Illuminate\Support\Facades\Input;
9
use Response;
10
/**
11
 * The WilayahIndonesiaController class.
12
 *
13
 * @package Bantenprov\WilayahIndonesia
14
 * @author  bantenprov <[email protected]>
15
 */
16
class WilayahIndonesiaController extends Controller
17
{
18
	protected $indonesia;
19
	protected $provinsi;
20
	protected $kabupaten;
21
	protected $kecamatan;
22
	protected $desa;
23
	
24
	public function __construct()
25
	{
26
		$this->indonesia 	= new Indonesia;
27
		$this->provinsi 	= new Provinsi;
28
	}
29
	public function provinsiindex()
30
	{
31
		$page 					= 10;
32
		$data 					= $this->indonesia->paginateProvinces($page);
33
		return Response::make(json_encode($data, JSON_PRETTY_PRINT))->header('Content-Type', "application/json");
34
	}
35
	public function provinsicreate()
36
	{
37
		
38
	}
39
	public function provinsishow()
40
	{
41
		
42
	}
43
	public function provinsiedit()
44
	{
45
		
46
	}
47
	public function provinsidelete()
48
	{
49
		
50
	}
51
	public function provinsipage()
52
	{
53
		
54
	}
55
	//END DATA PROVINSI
56
57
	//DATA KABUPATEN
58
	public function kabupatenindex()
59
	{	
60
		$page  					= 10;
61
		$res 					= $this->provinsi
0 ignored issues
show
Documentation Bug introduced by
The method select does not exist on object<Bantenprov\Wilaya...onesia\Models\Provinsi>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
62
								->select(
63
									'provinces.id as province_id',
64
									'provinces.name as province_name',
65
									'cities.id as city_id',
66
									'cities.name as city_name'
67
								)
68
								->leftjoin(
69
									'cities',
70
									'provinces.id','=','cities.province_id'
71
								)
72
								->paginate($page);
73
		return Response::make(json_encode($res, JSON_PRETTY_PRINT))->header('Content-Type', "application/json");
74
	}
75
	public function kabupatencreate()
76
	{
77
		
78
	}
79
	public function kabupatenshow()
80
	{
81
		
82
	}
83
	public function kabupatenedit()
84
	{
85
		
86
	}
87
	public function kabupatendelete()
88
	{
89
		
90
	}
91
	//END DATA KABUPATEN
92
93
	//DATA KECAMATAN
94
	public function kecamatanindex()
95
	{
96
		$page  					= 10;
97
		$res 					= $this->provinsi
0 ignored issues
show
Documentation Bug introduced by
The method select does not exist on object<Bantenprov\Wilaya...onesia\Models\Provinsi>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
98
								->select(
99
									'provinces.id as province_id',
100
									'provinces.name as province_name',
101
									'cities.id as city_id',
102
									'cities.name as city_name',
103
									'districts.id as district_id',
104
									'districts.name as district_name'
105
								)
106
								->leftjoin(
107
									'cities',
108
									'provinces.id','=','cities.province_id'
109
								)
110
								->leftjoin(
111
									'districts',
112
									'cities.id','=','districts.city_id'
113
								)
114
								->paginate($page);
115
		return Response::make(json_encode($res, JSON_PRETTY_PRINT))->header('Content-Type', "application/json");		
116
	}
117
	public function kecamatancreate()
118
	{
119
		
120
	}
121
	public function kecamatanshow()
122
	{
123
		
124
	}
125
	public function kecamatanedit()
126
	{
127
		
128
	}
129
	public function kecamatandelete()
130
	{
131
		
132
	}
133
	//END DATA KECAMATAN
134
135
	//DATA DESA
136
	public function desaindex()
137
	{
138
		$page  					= 10;
139
		$res 					= $this->provinsi
0 ignored issues
show
Documentation Bug introduced by
The method select does not exist on object<Bantenprov\Wilaya...onesia\Models\Provinsi>? Since you implemented __call, maybe consider adding a @method annotation.

If you implement __call and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.

This is often the case, when __call is implemented by a parent class and only the child class knows which methods exist:

class ParentClass {
    private $data = array();

    public function __call($method, array $args) {
        if (0 === strpos($method, 'get')) {
            return $this->data[strtolower(substr($method, 3))];
        }

        throw new \LogicException(sprintf('Unsupported method: %s', $method));
    }
}

/**
 * If this class knows which fields exist, you can specify the methods here:
 *
 * @method string getName()
 */
class SomeClass extends ParentClass { }
Loading history...
140
								->select(
141
									'provinces.id as province_id',
142
									'provinces.name as province_name',
143
									'cities.id as city_id',
144
									'cities.name as city_name',
145
									'districts.id as district_id',
146
									'districts.name as district_name',
147
									'villages.id as village_id',
148
									'villages.name as village_name'
149
								)
150
								->leftjoin(
151
									'cities',
152
									'provinces.id','=','cities.province_id'
153
								)
154
								->leftjoin(
155
									'districts',
156
									'cities.id','=','districts.city_id'
157
								)
158
								->leftjoin(
159
									'villages',
160
									'districts.id','=','villages.district_id'
161
								)
162
								->paginate($page);
163
		return Response::make(json_encode($res, JSON_PRETTY_PRINT))->header('Content-Type', "application/json");		
164
	}
165
	public function desacreate()
166
	{
167
		
168
	}
169
	public function desashow()
170
	{
171
		
172
	}
173
	public function desaedit()
174
	{
175
		
176
	}
177
	public function desadelete()
178
	{
179
		
180
	}
181
	//END DATA DESA
182
	
183
}
184