@@ -1,6 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -if (! function_exists('dashboardApel')) { |
|
3 | +if (!function_exists('dashboardApel')) { |
|
4 | 4 | function dashboardApel() |
5 | 5 | { |
6 | 6 | return 'Welcome to function dashboardApel() for Bantenprov\DashboardApel package'; |
@@ -18,7 +18,7 @@ |
||
18 | 18 | |
19 | 19 | public function getProvince() |
20 | 20 | { |
21 | - return $this->hasOne('Bantenprov\DashboardApel\Models\Bantenprov\DashboardApel\Province','id','province_id'); |
|
21 | + return $this->hasOne('Bantenprov\DashboardApel\Models\Bantenprov\DashboardApel\Province', 'id', 'province_id'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | } |
@@ -18,12 +18,12 @@ |
||
18 | 18 | |
19 | 19 | public function getProvince() |
20 | 20 | { |
21 | - return $this->hasOne('Bantenprov\DashboardApel\Models\Bantenprov\DashboardApel\Province','id','province_id'); |
|
21 | + return $this->hasOne('Bantenprov\DashboardApel\Models\Bantenprov\DashboardApel\Province', 'id', 'province_id'); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | public function getRegency() |
25 | 25 | { |
26 | - return $this->hasOne('Bantenprov\DashboardApel\Models\Bantenprov\DashboardApel\Regency','id','regency_id'); |
|
26 | + return $this->hasOne('Bantenprov\DashboardApel\Models\Bantenprov\DashboardApel\Regency', 'id', 'regency_id'); |
|
27 | 27 | } |
28 | 28 | |
29 | 29 | } |
@@ -11,12 +11,12 @@ |
||
11 | 11 | 'destroy' => 'Bantenprov\DashboardApel\Http\Controllers\DashboardApelController@destroy', |
12 | 12 | ]; |
13 | 13 | |
14 | - Route::get('/',$controllers->index)->name('dashboard-apel.index'); |
|
15 | - Route::get('/create',$controllers->create)->name('dashboard-apel.create'); |
|
16 | - Route::post('/store',$controllers->store)->name('dashboard-apel.store'); |
|
17 | - Route::get('/{id}',$controllers->show)->name('dashboard-apel.show'); |
|
18 | - Route::put('/{id}/update',$controllers->update)->name('dashboard-apel.update'); |
|
19 | - Route::post('/{id}/delete',$controllers->destroy)->name('dashboard-apel.destroy'); |
|
14 | + Route::get('/', $controllers->index)->name('dashboard-apel.index'); |
|
15 | + Route::get('/create', $controllers->create)->name('dashboard-apel.create'); |
|
16 | + Route::post('/store', $controllers->store)->name('dashboard-apel.store'); |
|
17 | + Route::get('/{id}', $controllers->show)->name('dashboard-apel.show'); |
|
18 | + Route::put('/{id}/update', $controllers->update)->name('dashboard-apel.update'); |
|
19 | + Route::post('/{id}/delete', $controllers->destroy)->name('dashboard-apel.destroy'); |
|
20 | 20 | |
21 | 21 | }); |
22 | 22 |
@@ -45,11 +45,11 @@ |
||
45 | 45 | */ |
46 | 46 | public function register() |
47 | 47 | { |
48 | - $this->app->singleton('dashboard-apel', function ($app) { |
|
48 | + $this->app->singleton('dashboard-apel', function($app) { |
|
49 | 49 | return new DashboardApel; |
50 | 50 | }); |
51 | 51 | |
52 | - $this->app->singleton('command.dashboard-apel', function ($app) { |
|
52 | + $this->app->singleton('command.dashboard-apel', function($app) { |
|
53 | 53 | return new DashboardApelCommand; |
54 | 54 | }); |
55 | 55 |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | { |
33 | 33 | $this->regency = $regency; |
34 | 34 | $this->province = $province; |
35 | - $this->dashboard_apel = $dashboard_apel; |
|
35 | + $this->dashboard_apel = $dashboard_apel; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | public function index(Request $request) |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | public function store(Request $request) |
70 | 70 | { |
71 | 71 | |
72 | - $validator = Validator::make($request->all(),[ |
|
72 | + $validator = Validator::make($request->all(), [ |
|
73 | 73 | 'negara' => 'required', |
74 | 74 | 'province_id' => 'required', |
75 | 75 | 'regency_id' => 'required', |
@@ -78,7 +78,7 @@ discard block |
||
78 | 78 | 'data' => 'required|integer', |
79 | 79 | ]); |
80 | 80 | |
81 | - if($validator->fails()) |
|
81 | + if ($validator->fails()) |
|
82 | 82 | { |
83 | 83 | return response()->json([ |
84 | 84 | 'title' => 'error', |
@@ -88,9 +88,9 @@ discard block |
||
88 | 88 | ]); |
89 | 89 | } |
90 | 90 | |
91 | - $check = $this->dashboard_apel->where('regency_id',$request->regency_id)->where('tahun',$request->tahun)->count(); |
|
91 | + $check = $this->dashboard_apel->where('regency_id', $request->regency_id)->where('tahun', $request->tahun)->count(); |
|
92 | 92 | |
93 | - if($check > 0) |
|
93 | + if ($check > 0) |
|
94 | 94 | { |
95 | 95 | return response()->json([ |
96 | 96 | 'title' => 'error', |
@@ -98,14 +98,14 @@ discard block |
||
98 | 98 | 'type' => 'failed', |
99 | 99 | ]); |
100 | 100 | |
101 | - }else{ |
|
101 | + }else { |
|
102 | 102 | $data = $this->dashboard_apel->create($request->all()); |
103 | 103 | |
104 | 104 | return response()->json([ |
105 | 105 | 'type' => 'success', |
106 | 106 | 'title' => 'success', |
107 | 107 | 'id' => $data->id, |
108 | - 'message' => 'PDRB '. $this->regency->find($request->regency_id)->name .' tahun '. $request->tahun .' successfully created', |
|
108 | + 'message' => 'PDRB '.$this->regency->find($request->regency_id)->name.' tahun '.$request->tahun.' successfully created', |
|
109 | 109 | ]); |
110 | 110 | } |
111 | 111 |