@@ -71,31 +71,31 @@ |
||
| 71 | 71 | |
| 72 | 72 | protected function controllerViewCreate() |
| 73 | 73 | { |
| 74 | - foreach($this->stubsController['controllers'] as $stub) |
|
| 74 | + foreach ($this->stubsController['controllers'] as $stub) |
|
| 75 | 75 | { |
| 76 | - File::put(base_path('app/Http/Controllers/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/Controllers/'.$stub)); |
|
| 76 | + File::put(base_path('app/Http/Controllers/').str_replace('stub', 'php', $stub), File::get(__DIR__.'/../../stubs/Controllers/'.$stub)); |
|
| 77 | 77 | } |
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | protected function modelViewCreate() |
| 81 | 81 | { |
| 82 | - foreach($this->stubsModel['models'] as $stub) |
|
| 82 | + foreach ($this->stubsModel['models'] as $stub) |
|
| 83 | 83 | { |
| 84 | - File::put(base_path('app/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/Models/'.$stub)); |
|
| 84 | + File::put(base_path('app/').str_replace('stub', 'php', $stub), File::get(__DIR__.'/../../stubs/Models/'.$stub)); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | protected function routeViewCreate() |
| 89 | 89 | { |
| 90 | - File::append(base_path('routes/web.php'),File::get(__DIR__.'/../../stubs/routesweb.stub')); |
|
| 91 | - File::append(base_path('routes/api.php'),File::get(__DIR__.'/../../stubs/routesapi.stub')); |
|
| 90 | + File::append(base_path('routes/web.php'), File::get(__DIR__.'/../../stubs/routesweb.stub')); |
|
| 91 | + File::append(base_path('routes/api.php'), File::get(__DIR__.'/../../stubs/routesapi.stub')); |
|
| 92 | 92 | } |
| 93 | 93 | |
| 94 | 94 | protected function seedsViewCreate() |
| 95 | 95 | { |
| 96 | - foreach($this->stubsSeeds['seeds'] as $stub) |
|
| 96 | + foreach ($this->stubsSeeds['seeds'] as $stub) |
|
| 97 | 97 | { |
| 98 | - File::put(base_path('database/seeds/').str_replace('stub','php',$stub),File::get(__DIR__.'/../../stubs/seeds/'.$stub)); |
|
| 98 | + File::put(base_path('database/seeds/').str_replace('stub', 'php', $stub), File::get(__DIR__.'/../../stubs/seeds/'.$stub)); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | |
@@ -41,11 +41,11 @@ |
||
| 41 | 41 | */ |
| 42 | 42 | public function register() |
| 43 | 43 | { |
| 44 | - $this->app->singleton('epormas', function ($app) { |
|
| 44 | + $this->app->singleton('epormas', function($app) { |
|
| 45 | 45 | return new Epormas; |
| 46 | 46 | }); |
| 47 | 47 | |
| 48 | - $this->app->singleton('command.epormas', function ($app) { |
|
| 48 | + $this->app->singleton('command.epormas', function($app) { |
|
| 49 | 49 | return new EpormasCommand; |
| 50 | 50 | }); |
| 51 | 51 | |
@@ -17,8 +17,8 @@ discard block |
||
| 17 | 17 | { |
| 18 | 18 | //Pegawai Epormas |
| 19 | 19 | $grafikepormascounter = DB::table('epormas_counter') |
| 20 | - ->select('tahun','bulan','city_id', DB::raw('SUM(count) as count')) |
|
| 21 | - ->whereNull('deleted_at')->groupBy('tahun','bulan','city_id')->orderBy('bulan')->get(); |
|
| 20 | + ->select('tahun', 'bulan', 'city_id', DB::raw('SUM(count) as count')) |
|
| 21 | + ->whereNull('deleted_at')->groupBy('tahun', 'bulan', 'city_id')->orderBy('bulan')->get(); |
|
| 22 | 22 | $grafiktahunepormascounter = DB::table('epormas_counter') |
| 23 | 23 | ->select('tahun', DB::raw('SUM(count) as count')) |
| 24 | 24 | ->whereNull('deleted_at')->groupBy('tahun')->orderBy('tahun')->get(); |
@@ -40,51 +40,51 @@ discard block |
||
| 40 | 40 | $grafikbulanepormascounter = []; |
| 41 | 41 | $grafiktotalepormascounter = []; |
| 42 | 42 | $grafikpieepormascounter = []; |
| 43 | - for($q=0; $q<$countgrafiktahunepormascounter; $q++){ |
|
| 43 | + for ($q = 0; $q < $countgrafiktahunepormascounter; $q++) { |
|
| 44 | 44 | $tahungrafikepormascounter = $grafiktahunepormascounter[$q]->tahun; |
| 45 | 45 | $gcountepormascounter = (int)$grafiktahunepormascounter[$q]->count; |
| 46 | 46 | $totaldataepormascounter = $gcountepormascounter; |
| 47 | - array_push($datagrafiktahunepormascounter,$tahungrafikepormascounter); |
|
| 48 | - array_push($datagrafikcountepormascounter,$gcountepormascounter); |
|
| 49 | - array_push($datagrafiktotalepormascounter,$totaldataepormascounter); |
|
| 47 | + array_push($datagrafiktahunepormascounter, $tahungrafikepormascounter); |
|
| 48 | + array_push($datagrafikcountepormascounter, $gcountepormascounter); |
|
| 49 | + array_push($datagrafiktotalepormascounter, $totaldataepormascounter); |
|
| 50 | 50 | |
| 51 | - for($kota=1; $kota<=$countcity; $kota++){ |
|
| 52 | - for ($index=0; $index<12; $index++) { |
|
| 51 | + for ($kota = 1; $kota <= $countcity; $kota++) { |
|
| 52 | + for ($index = 0; $index < 12; $index++) { |
|
| 53 | 53 | $grafikcountepormascounter[$q][$kota][$index] = 0; |
| 54 | 54 | $grafikbulanepormascounter[$q][$kota][$index] = 0; |
| 55 | 55 | $grafiktotalepormascounter[$q][$kota][$index] = 0; |
| 56 | - $grafikpieepormascounter[$q][$kota][$index] = ['value'=>0,'name'=>$namaBulan[$index]]; |
|
| 56 | + $grafikpieepormascounter[$q][$kota][$index] = ['value'=>0, 'name'=>$namaBulan[$index]]; |
|
| 57 | 57 | $totaldatagrafikepormascounter[$q][$index] = 0; |
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | - for($r=0; $r<$countgrafikepormascounter; $r++){ |
|
| 60 | + for ($r = 0; $r < $countgrafikepormascounter; $r++) { |
|
| 61 | 61 | $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
| 62 | 62 | $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
| 63 | 63 | $city_id = $grafikepormascounter[$r]->city_id; |
| 64 | - if($bulansepormascounter < 10){ |
|
| 65 | - $bulanepormascounter = substr($bulansepormascounter,1); |
|
| 64 | + if ($bulansepormascounter < 10) { |
|
| 65 | + $bulanepormascounter = substr($bulansepormascounter, 1); |
|
| 66 | 66 | }else { |
| 67 | 67 | $bulanepormascounter = $bulansepormascounter; |
| 68 | 68 | } |
| 69 | - if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
| 69 | + if ($tahungrafikepormascounter == $tahunsepormascounter) { |
|
| 70 | 70 | $totaldatagrafikepormascounter[$q][$bulanepormascounter-1] += $grafikepormascounter[$r]->count; |
| 71 | 71 | } |
| 72 | 72 | } |
| 73 | - for($r=0; $r<$countgrafikepormascounter; $r++){ |
|
| 73 | + for ($r = 0; $r < $countgrafikepormascounter; $r++) { |
|
| 74 | 74 | $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
| 75 | 75 | $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
| 76 | 76 | $city_id = $grafikepormascounter[$r]->city_id; |
| 77 | - if($bulansepormascounter < 10){ |
|
| 78 | - $bulanepormascounter = substr($bulansepormascounter,1); |
|
| 77 | + if ($bulansepormascounter < 10) { |
|
| 78 | + $bulanepormascounter = substr($bulansepormascounter, 1); |
|
| 79 | 79 | }else { |
| 80 | 80 | $bulanepormascounter = $bulansepormascounter; |
| 81 | 81 | } |
| 82 | - if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
| 82 | + if ($tahungrafikepormascounter == $tahunsepormascounter) { |
|
| 83 | 83 | $grafikcountepormascounter[$q][$city_id][$bulanepormascounter-1] = (int)$grafikepormascounter[$r]->count; |
| 84 | 84 | $grafikbulanepormascounter[$q][$city_id][$bulanepormascounter-1] = $grafikepormascounter[$r]->bulan; |
| 85 | 85 | $totaldatagrafikepormascounters = $totaldatagrafikepormascounter[$q][$bulanepormascounter-1]; |
| 86 | 86 | $grafiktotalepormascounter[$q][$city_id][$bulanepormascounter-1] = $totaldatagrafikepormascounters; |
| 87 | - $grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters,'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
| 87 | + $grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters, 'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | } |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -if (! function_exists('epormas')) { |
|
| 3 | +if (!function_exists('epormas')) { |
|
| 4 | 4 | function epormas() |
| 5 | 5 | { |
| 6 | 6 | return 'Welcome to function epormas() for Dashboard\Epormas package'; |
@@ -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 | |
@@ -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 | |
@@ -91,18 +91,18 @@ discard block |
||
| 91 | 91 | * |
| 92 | 92 | * @return Response |
| 93 | 93 | */ |
| 94 | - public function store(Request $request, $version='') |
|
| 94 | + public function store(Request $request, $version = '') |
|
| 95 | 95 | {
|
| 96 | 96 | $path = \Request::path(); |
| 97 | 97 | $explode = explode('/', $path);
|
| 98 | 98 | |
| 99 | 99 | $from = 'form'; |
| 100 | - if(in_array('api',$explode)){
|
|
| 100 | + if (in_array('api', $explode)) {
|
|
| 101 | 101 | $from = 'api'; |
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | $via = $from; |
| 105 | - if($version != '' && $version != 'store'){
|
|
| 105 | + if ($version != '' && $version != 'store') {
|
|
| 106 | 106 | $via .= '-'.$version; |
| 107 | 107 | } |
| 108 | 108 | |
@@ -122,20 +122,20 @@ discard block |
||
| 122 | 122 | )); |
| 123 | 123 | } |
| 124 | 124 | |
| 125 | - if($request->tanggal){
|
|
| 126 | - $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
|
| 125 | + if ($request->tanggal) {
|
|
| 126 | + $formats = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
|
|
| 127 | 127 | }else {
|
| 128 | 128 | $formats = ''; |
| 129 | 129 | } |
| 130 | 130 | $format = $formats; |
| 131 | 131 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 132 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 133 | - ->where('category_id',$request->category_id)
|
|
| 134 | - ->where('city_id',$request->city_id)
|
|
| 135 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 132 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 133 | + ->where('category_id', $request->category_id)
|
|
| 134 | + ->where('city_id', $request->city_id)
|
|
| 135 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 136 | 136 | ->orderBy('bulan')
|
| 137 | 137 | ->count(); |
| 138 | - if($resultcek > 0){
|
|
| 138 | + if ($resultcek > 0) {
|
|
| 139 | 139 | return Response::json(array( |
| 140 | 140 | 'title' => 'Error', |
| 141 | 141 | 'type' => 'error', |
@@ -143,16 +143,16 @@ discard block |
||
| 143 | 143 | )); |
| 144 | 144 | } |
| 145 | 145 | |
| 146 | - $date = explode("-",$format);
|
|
| 146 | + $date = explode("-", $format);
|
|
| 147 | 147 | $data = EpormasCounter::whereNull('deleted_at')
|
| 148 | 148 | ->where('tahun', $date[0])
|
| 149 | 149 | ->where('bulan', $date[1])
|
| 150 | - ->where('category_id',$request->category_id)
|
|
| 151 | - ->where('city_id',$request->city_id)
|
|
| 152 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 150 | + ->where('category_id', $request->category_id)
|
|
| 151 | + ->where('city_id', $request->city_id)
|
|
| 152 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 153 | 153 | ->orderBy('bulan')
|
| 154 | 154 | ->count(); |
| 155 | - if($data > 0){
|
|
| 155 | + if ($data > 0) {
|
|
| 156 | 156 | return Response::json(array( |
| 157 | 157 | 'title' => 'Error', |
| 158 | 158 | 'type' => 'error', |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @param int $id |
| 192 | 192 | * @return Response |
| 193 | 193 | */ |
| 194 | - public function show($version='', $id) |
|
| 194 | + public function show($version = '', $id) |
|
| 195 | 195 | {
|
| 196 | 196 | try {
|
| 197 | 197 | $error = false; |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | ->with('getCity')
|
| 243 | 243 | ->with('getCategory')
|
| 244 | 244 | ->find($id); |
| 245 | - if($result->tanggal){
|
|
| 245 | + if ($result->tanggal) {
|
|
| 246 | 246 | $formats = date('Y-m-d', strtotime($result->tanggal));
|
| 247 | 247 | }else {
|
| 248 | 248 | $formats = 'Not Found'; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | * @param int $id |
| 280 | 280 | * @return Response |
| 281 | 281 | */ |
| 282 | - public function update(Request $request, $version='', $id) |
|
| 282 | + public function update(Request $request, $version = '', $id) |
|
| 283 | 283 | {
|
| 284 | 284 | $result = EpormasCounter::whereNull('deleted_at')
|
| 285 | 285 | ->with('getCity')
|
@@ -302,21 +302,21 @@ discard block |
||
| 302 | 302 | )); |
| 303 | 303 | } |
| 304 | 304 | |
| 305 | - if($request->tanggal){
|
|
| 306 | - $formats = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
|
| 305 | + if ($request->tanggal) {
|
|
| 306 | + $formats = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
|
|
| 307 | 307 | }else {
|
| 308 | 308 | $formats = ''; |
| 309 | 309 | } |
| 310 | 310 | $format = $formats; |
| 311 | - if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
|
|
| 311 | + if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) {
|
|
| 312 | 312 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 313 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 314 | - ->where('category_id',$request->category_id)
|
|
| 315 | - ->where('city_id',$request->city_id)
|
|
| 316 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 313 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 314 | + ->where('category_id', $request->category_id)
|
|
| 315 | + ->where('city_id', $request->city_id)
|
|
| 316 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 317 | 317 | ->orderBy('bulan')
|
| 318 | 318 | ->count(); |
| 319 | - if($resultcek > 0){
|
|
| 319 | + if ($resultcek > 0) {
|
|
| 320 | 320 | return Response::json(array( |
| 321 | 321 | 'title' => 'Error', |
| 322 | 322 | 'type' => 'error', |
@@ -325,17 +325,17 @@ discard block |
||
| 325 | 325 | } |
| 326 | 326 | } |
| 327 | 327 | |
| 328 | - $date = explode("-",$format);
|
|
| 328 | + $date = explode("-", $format);
|
|
| 329 | 329 | $dates = date('Y-m-d', strtotime($result->tanggal));
|
| 330 | - if($dates != $format){
|
|
| 330 | + if ($dates != $format) {
|
|
| 331 | 331 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 332 | - ->where('category_id',$request->category_id)
|
|
| 333 | - ->where('city_id',$request->city_id)
|
|
| 334 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 335 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 332 | + ->where('category_id', $request->category_id)
|
|
| 333 | + ->where('city_id', $request->city_id)
|
|
| 334 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 335 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 336 | 336 | ->orderBy('bulan')
|
| 337 | 337 | ->count(); |
| 338 | - if($resultcek > 0){
|
|
| 338 | + if ($resultcek > 0) {
|
|
| 339 | 339 | return Response::json(array( |
| 340 | 340 | 'title' => 'Error', |
| 341 | 341 | 'type' => 'error', |
@@ -346,12 +346,12 @@ discard block |
||
| 346 | 346 | $data = EpormasCounter::whereNull('deleted_at')
|
| 347 | 347 | ->where('tahun', $date[0])
|
| 348 | 348 | ->where('bulan', $date[1])
|
| 349 | - ->where('category_id',$request->category_id)
|
|
| 350 | - ->where('city_id',$request->city_id)
|
|
| 351 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 349 | + ->where('category_id', $request->category_id)
|
|
| 350 | + ->where('city_id', $request->city_id)
|
|
| 351 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 352 | 352 | ->orderBy('bulan')
|
| 353 | 353 | ->count(); |
| 354 | - if($data > 0){
|
|
| 354 | + if ($data > 0) {
|
|
| 355 | 355 | return Response::json(array( |
| 356 | 356 | 'title' => 'Error', |
| 357 | 357 | 'type' => 'error', |
@@ -365,13 +365,13 @@ discard block |
||
| 365 | 365 | |
| 366 | 366 | $from = $result->via; |
| 367 | 367 | $user_id = $result->user_id; |
| 368 | - if(in_array('api',$explode)){
|
|
| 368 | + if (in_array('api', $explode)) {
|
|
| 369 | 369 | $from = 'api'; |
| 370 | 370 | $user_id = $request->user_id; |
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | $via = $from; |
| 374 | - if($version != '' && $version != 'update'){
|
|
| 374 | + if ($version != '' && $version != 'update') {
|
|
| 375 | 375 | $via .= '-'.$version; |
| 376 | 376 | } |
| 377 | 377 | |