@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return Response |
| 69 | 69 | */ |
| 70 | - public function store(Request $request, $version='') |
|
| 70 | + public function store(Request $request, $version = '') |
|
| 71 | 71 | {
|
| 72 | 72 | $path = \Request::path(); |
| 73 | 73 | $explode = explode('/', $path);
|
| 74 | 74 | |
| 75 | 75 | $from = 'form'; |
| 76 | - if(in_array('api',$explode)){
|
|
| 76 | + if (in_array('api', $explode)) {
|
|
| 77 | 77 | $from = 'api'; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $via = $from; |
| 81 | - if($version != '' && $version != 'store'){
|
|
| 81 | + if ($version != '' && $version != 'store') {
|
|
| 82 | 82 | $via .= '-'.$version; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $data = EpormasCategory::whereNull('deleted_at')
|
| 99 | 99 | ->where('name', $request->name)
|
| 100 | 100 | ->count(); |
| 101 | - if($data > 0){
|
|
| 101 | + if ($data > 0) {
|
|
| 102 | 102 | return Response::json(array( |
| 103 | 103 | 'title' => 'Error', |
| 104 | 104 | 'type' => 'error', |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param int $id |
| 148 | 148 | * @return Response |
| 149 | 149 | */ |
| 150 | - public function show($version='', $id) |
|
| 150 | + public function show($version = '', $id) |
|
| 151 | 151 | {
|
| 152 | 152 | try {
|
| 153 | 153 | $error = false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param int $id |
| 230 | 230 | * @return Response |
| 231 | 231 | */ |
| 232 | - public function update(Request $request, $version='', $id) |
|
| 232 | + public function update(Request $request, $version = '', $id) |
|
| 233 | 233 | {
|
| 234 | 234 | $result = EpormasCategory::find($id); |
| 235 | 235 | |
@@ -245,11 +245,11 @@ discard block |
||
| 245 | 245 | )); |
| 246 | 246 | } |
| 247 | 247 | |
| 248 | - if($request->name != $result->name){
|
|
| 248 | + if ($request->name != $result->name) {
|
|
| 249 | 249 | $data = EpormasCategory::whereNull('deleted_at')
|
| 250 | 250 | ->where('name', $request->name)
|
| 251 | 251 | ->count(); |
| 252 | - if($data > 0){
|
|
| 252 | + if ($data > 0) {
|
|
| 253 | 253 | return Response::json(array( |
| 254 | 254 | 'title' => 'Error', |
| 255 | 255 | 'type' => 'error', |
@@ -262,12 +262,12 @@ discard block |
||
| 262 | 262 | $explode = explode('/', $path);
|
| 263 | 263 | |
| 264 | 264 | $from = 'form'; |
| 265 | - if(in_array('api',$explode)){
|
|
| 265 | + if (in_array('api', $explode)) {
|
|
| 266 | 266 | $from = 'api'; |
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | $via = $from; |
| 270 | - if($version != '' && $version != 'update'){
|
|
| 270 | + if ($version != '' && $version != 'update') {
|
|
| 271 | 271 | $via .= '-'.$version; |
| 272 | 272 | } |
| 273 | 273 | |
@@ -106,18 +106,18 @@ discard block |
||
| 106 | 106 | * |
| 107 | 107 | * @return Response |
| 108 | 108 | */ |
| 109 | - public function store(Request $request, $version='') |
|
| 109 | + public function store(Request $request, $version = '') |
|
| 110 | 110 | {
|
| 111 | 111 | $path = \Request::path(); |
| 112 | 112 | $explode = explode('/', $path);
|
| 113 | 113 | |
| 114 | 114 | $from = 'form'; |
| 115 | - if(in_array('api',$explode)){
|
|
| 115 | + if (in_array('api', $explode)) {
|
|
| 116 | 116 | $from = 'api'; |
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | $via = $from; |
| 120 | - if($version != '' && $version != 'store'){
|
|
| 120 | + if ($version != '' && $version != 'store') {
|
|
| 121 | 121 | $via .= '-'.$version; |
| 122 | 122 | } |
| 123 | 123 | |
@@ -137,15 +137,15 @@ discard block |
||
| 137 | 137 | )); |
| 138 | 138 | } |
| 139 | 139 | |
| 140 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
|
| 140 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
|
|
| 141 | 141 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 142 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 143 | - ->where('category_id',$request->category_id)
|
|
| 144 | - ->where('city_id',$request->city_id)
|
|
| 145 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 142 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 143 | + ->where('category_id', $request->category_id)
|
|
| 144 | + ->where('city_id', $request->city_id)
|
|
| 145 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 146 | 146 | ->orderBy('bulan')
|
| 147 | 147 | ->count(); |
| 148 | - if($resultcek > 0){
|
|
| 148 | + if ($resultcek > 0) {
|
|
| 149 | 149 | return Response::json(array( |
| 150 | 150 | 'title' => 'Error', |
| 151 | 151 | 'type' => 'error', |
@@ -153,16 +153,16 @@ discard block |
||
| 153 | 153 | )); |
| 154 | 154 | } |
| 155 | 155 | |
| 156 | - $date = explode("-",$format);
|
|
| 156 | + $date = explode("-", $format);
|
|
| 157 | 157 | $data = EpormasCounter::whereNull('deleted_at')
|
| 158 | 158 | ->where('tahun', $date[0])
|
| 159 | 159 | ->where('bulan', $date[1])
|
| 160 | - ->where('category_id',$request->category_id)
|
|
| 161 | - ->where('city_id',$request->city_id)
|
|
| 162 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 160 | + ->where('category_id', $request->category_id)
|
|
| 161 | + ->where('city_id', $request->city_id)
|
|
| 162 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 163 | 163 | ->orderBy('bulan')
|
| 164 | 164 | ->count(); |
| 165 | - if($data > 0){
|
|
| 165 | + if ($data > 0) {
|
|
| 166 | 166 | return Response::json(array( |
| 167 | 167 | 'title' => 'Error', |
| 168 | 168 | 'type' => 'error', |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * @param int $id |
| 219 | 219 | * @return Response |
| 220 | 220 | */ |
| 221 | - public function show($version='', $id) |
|
| 221 | + public function show($version = '', $id) |
|
| 222 | 222 | {
|
| 223 | 223 | try {
|
| 224 | 224 | $error = false; |
@@ -318,7 +318,7 @@ discard block |
||
| 318 | 318 | * @param int $id |
| 319 | 319 | * @return Response |
| 320 | 320 | */ |
| 321 | - public function update(Request $request, $version='', $id) |
|
| 321 | + public function update(Request $request, $version = '', $id) |
|
| 322 | 322 | {
|
| 323 | 323 | $result = EpormasCounter::whereNull('deleted_at')
|
| 324 | 324 | ->with('getCity')
|
@@ -341,16 +341,16 @@ discard block |
||
| 341 | 341 | )); |
| 342 | 342 | } |
| 343 | 343 | |
| 344 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
|
| 345 | - if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
|
|
| 344 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
|
|
| 345 | + if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) {
|
|
| 346 | 346 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 347 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 348 | - ->where('category_id',$request->category_id)
|
|
| 349 | - ->where('city_id',$request->city_id)
|
|
| 350 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 347 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 348 | + ->where('category_id', $request->category_id)
|
|
| 349 | + ->where('city_id', $request->city_id)
|
|
| 350 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 351 | 351 | ->orderBy('bulan')
|
| 352 | 352 | ->count(); |
| 353 | - if($resultcek > 0){
|
|
| 353 | + if ($resultcek > 0) {
|
|
| 354 | 354 | return Response::json(array( |
| 355 | 355 | 'title' => 'Error', |
| 356 | 356 | 'type' => 'error', |
@@ -359,17 +359,17 @@ discard block |
||
| 359 | 359 | } |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $date = explode("-",$format);
|
|
| 362 | + $date = explode("-", $format);
|
|
| 363 | 363 | $dates = date('Y-m-d', strtotime($result->tanggal));
|
| 364 | - if($dates != $format){
|
|
| 364 | + if ($dates != $format) {
|
|
| 365 | 365 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 366 | - ->where('category_id',$request->category_id)
|
|
| 367 | - ->where('city_id',$request->city_id)
|
|
| 368 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 369 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 366 | + ->where('category_id', $request->category_id)
|
|
| 367 | + ->where('city_id', $request->city_id)
|
|
| 368 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 369 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 370 | 370 | ->orderBy('bulan')
|
| 371 | 371 | ->count(); |
| 372 | - if($resultcek > 0){
|
|
| 372 | + if ($resultcek > 0) {
|
|
| 373 | 373 | return Response::json(array( |
| 374 | 374 | 'title' => 'Error', |
| 375 | 375 | 'type' => 'error', |
@@ -380,12 +380,12 @@ discard block |
||
| 380 | 380 | $data = EpormasCounter::whereNull('deleted_at')
|
| 381 | 381 | ->where('tahun', $date[0])
|
| 382 | 382 | ->where('bulan', $date[1])
|
| 383 | - ->where('category_id',$request->category_id)
|
|
| 384 | - ->where('city_id',$request->city_id)
|
|
| 385 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 383 | + ->where('category_id', $request->category_id)
|
|
| 384 | + ->where('city_id', $request->city_id)
|
|
| 385 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 386 | 386 | ->orderBy('bulan')
|
| 387 | 387 | ->count(); |
| 388 | - if($data > 0){
|
|
| 388 | + if ($data > 0) {
|
|
| 389 | 389 | return Response::json(array( |
| 390 | 390 | 'title' => 'Error', |
| 391 | 391 | 'type' => 'error', |
@@ -399,13 +399,13 @@ discard block |
||
| 399 | 399 | |
| 400 | 400 | $from = $result->via; |
| 401 | 401 | $user_id = $result->user_id; |
| 402 | - if(in_array('api',$explode)){
|
|
| 402 | + if (in_array('api', $explode)) {
|
|
| 403 | 403 | $from = 'api'; |
| 404 | 404 | $user_id = $request->user_id; |
| 405 | 405 | } |
| 406 | 406 | |
| 407 | 407 | $via = $from; |
| 408 | - if($version != '' && $version != 'update'){
|
|
| 408 | + if ($version != '' && $version != 'update') {
|
|
| 409 | 409 | $via .= '-'.$version; |
| 410 | 410 | } |
| 411 | 411 | |
@@ -67,18 +67,18 @@ discard block |
||
| 67 | 67 | * |
| 68 | 68 | * @return Response |
| 69 | 69 | */ |
| 70 | - public function store(Request $request, $version='') |
|
| 70 | + public function store(Request $request, $version = '') |
|
| 71 | 71 | {
|
| 72 | 72 | $path = \Request::path(); |
| 73 | 73 | $explode = explode('/', $path);
|
| 74 | 74 | |
| 75 | 75 | $from = 'form'; |
| 76 | - if(in_array('api',$explode)){
|
|
| 76 | + if (in_array('api', $explode)) {
|
|
| 77 | 77 | $from = 'api'; |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | $via = $from; |
| 81 | - if($version != '' && $version != 'store'){
|
|
| 81 | + if ($version != '' && $version != 'store') {
|
|
| 82 | 82 | $via .= '-'.$version; |
| 83 | 83 | } |
| 84 | 84 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $data = EpormasCity::whereNull('deleted_at')
|
| 99 | 99 | ->where('name', $request->name)
|
| 100 | 100 | ->count(); |
| 101 | - if($data > 0){
|
|
| 101 | + if ($data > 0) {
|
|
| 102 | 102 | return Response::json(array( |
| 103 | 103 | 'title' => 'Error', |
| 104 | 104 | 'type' => 'error', |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | * @param int $id |
| 148 | 148 | * @return Response |
| 149 | 149 | */ |
| 150 | - public function show($version='', $id) |
|
| 150 | + public function show($version = '', $id) |
|
| 151 | 151 | {
|
| 152 | 152 | try {
|
| 153 | 153 | $error = false; |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @param int $id |
| 230 | 230 | * @return Response |
| 231 | 231 | */ |
| 232 | - public function update(Request $request, $version='', $id) |
|
| 232 | + public function update(Request $request, $version = '', $id) |
|
| 233 | 233 | {
|
| 234 | 234 | $result = EpormasCity::find($id); |
| 235 | 235 | |
@@ -246,11 +246,11 @@ discard block |
||
| 246 | 246 | )); |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | - if($request->name != $result->name){
|
|
| 249 | + if ($request->name != $result->name) {
|
|
| 250 | 250 | $data = EpormasCity::whereNull('deleted_at')
|
| 251 | 251 | ->where('name', $request->name)
|
| 252 | 252 | ->count(); |
| 253 | - if($data > 0){
|
|
| 253 | + if ($data > 0) {
|
|
| 254 | 254 | return Response::json(array( |
| 255 | 255 | 'title' => 'Error', |
| 256 | 256 | 'type' => 'error', |
@@ -263,12 +263,12 @@ discard block |
||
| 263 | 263 | $explode = explode('/', $path);
|
| 264 | 264 | |
| 265 | 265 | $from = 'form'; |
| 266 | - if(in_array('api',$explode)){
|
|
| 266 | + if (in_array('api', $explode)) {
|
|
| 267 | 267 | $from = 'api'; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | 270 | $via = $from; |
| 271 | - if($version != '' && $version != 'update'){
|
|
| 271 | + if ($version != '' && $version != 'update') {
|
|
| 272 | 272 | $via .= '-'.$version; |
| 273 | 273 | } |
| 274 | 274 | |