@@ -35,28 +35,28 @@ |
||
| 35 | 35 | * @var string |
| 36 | 36 | */ |
| 37 | 37 | protected $stubsController = [ |
| 38 | - 'controllers' => [ |
|
| 39 | - 'DashboardEpormasController.stub', |
|
| 40 | - 'EpormasCategoryController.stub', |
|
| 41 | - 'EpormasCityController.stub', |
|
| 42 | - 'EpormasCounterController.stub' |
|
| 43 | - ] |
|
| 38 | + 'controllers' => [ |
|
| 39 | + 'DashboardEpormasController.stub', |
|
| 40 | + 'EpormasCategoryController.stub', |
|
| 41 | + 'EpormasCityController.stub', |
|
| 42 | + 'EpormasCounterController.stub' |
|
| 43 | + ] |
|
| 44 | 44 | ]; |
| 45 | 45 | |
| 46 | 46 | protected $stubsModel = [ |
| 47 | - 'models' => [ |
|
| 48 | - 'EpormasCategory.stub', |
|
| 49 | - 'EpormasCity.stub', |
|
| 50 | - 'EpormasCounter.stub' |
|
| 51 | - ] |
|
| 47 | + 'models' => [ |
|
| 48 | + 'EpormasCategory.stub', |
|
| 49 | + 'EpormasCity.stub', |
|
| 50 | + 'EpormasCounter.stub' |
|
| 51 | + ] |
|
| 52 | 52 | ]; |
| 53 | 53 | |
| 54 | 54 | protected $stubsSeeds = [ |
| 55 | - 'seeds' => [ |
|
| 56 | - 'EpormasCategoryTableSeeder.stub', |
|
| 57 | - 'EpormasCityTableSeeder.stub', |
|
| 58 | - 'EpormasCounterTableSeeder.stub' |
|
| 59 | - ] |
|
| 55 | + 'seeds' => [ |
|
| 56 | + 'EpormasCategoryTableSeeder.stub', |
|
| 57 | + 'EpormasCityTableSeeder.stub', |
|
| 58 | + 'EpormasCounterTableSeeder.stub' |
|
| 59 | + ] |
|
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -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 | |
@@ -15,32 +15,32 @@ discard block |
||
| 15 | 15 | { |
| 16 | 16 | public function epormas() |
| 17 | 17 | { |
| 18 | - //Pegawai Epormas |
|
| 19 | - $grafikepormascounter = DB::table('epormas_counter') |
|
| 18 | + //Pegawai Epormas |
|
| 19 | + $grafikepormascounter = DB::table('epormas_counter') |
|
| 20 | 20 | ->select('tahun','bulan','city_id', DB::raw('SUM(count) as count')) |
| 21 | 21 | ->whereNull('deleted_at')->groupBy('tahun','bulan','city_id')->orderBy('bulan')->get(); |
| 22 | - $grafiktahunepormascounter = DB::table('epormas_counter') |
|
| 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(); |
| 25 | 25 | |
| 26 | - $namaBulan = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
|
| 27 | - $namaBulans = array('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'); |
|
| 28 | - $city = EpormasCity::all(); |
|
| 29 | - $category = EpormasCategory::all(); |
|
| 30 | - $countcity = count($city); |
|
| 31 | - $countcategory = count($category); |
|
| 26 | + $namaBulan = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); |
|
| 27 | + $namaBulans = array('Januari', 'Februari', 'Maret', 'April', 'Mei', 'Juni', 'Juli', 'Agustus', 'September', 'Oktober', 'November', 'Desember'); |
|
| 28 | + $city = EpormasCity::all(); |
|
| 29 | + $category = EpormasCategory::all(); |
|
| 30 | + $countcity = count($city); |
|
| 31 | + $countcategory = count($category); |
|
| 32 | 32 | |
| 33 | - $countgrafikepormascounter = count($grafikepormascounter); |
|
| 34 | - $countgrafiktahunepormascounter = count($grafiktahunepormascounter); |
|
| 35 | - $datagrafikepormascounter = []; |
|
| 36 | - $datagrafiktahunepormascounter = []; |
|
| 37 | - $datagrafikcountepormascounter = []; |
|
| 38 | - $datagrafiktotalepormascounter = []; |
|
| 39 | - $grafikcountepormascounter = []; |
|
| 40 | - $grafikbulanepormascounter = []; |
|
| 41 | - $grafiktotalepormascounter = []; |
|
| 42 | - $grafikpieepormascounter = []; |
|
| 43 | - for($q=0; $q<$countgrafiktahunepormascounter; $q++){ |
|
| 33 | + $countgrafikepormascounter = count($grafikepormascounter); |
|
| 34 | + $countgrafiktahunepormascounter = count($grafiktahunepormascounter); |
|
| 35 | + $datagrafikepormascounter = []; |
|
| 36 | + $datagrafiktahunepormascounter = []; |
|
| 37 | + $datagrafikcountepormascounter = []; |
|
| 38 | + $datagrafiktotalepormascounter = []; |
|
| 39 | + $grafikcountepormascounter = []; |
|
| 40 | + $grafikbulanepormascounter = []; |
|
| 41 | + $grafiktotalepormascounter = []; |
|
| 42 | + $grafikpieepormascounter = []; |
|
| 43 | + for($q=0; $q<$countgrafiktahunepormascounter; $q++){ |
|
| 44 | 44 | $tahungrafikepormascounter = $grafiktahunepormascounter[$q]->tahun; |
| 45 | 45 | $gcountepormascounter = (int)$grafiktahunepormascounter[$q]->count; |
| 46 | 46 | $totaldataepormascounter = $gcountepormascounter; |
@@ -50,47 +50,47 @@ discard block |
||
| 50 | 50 | |
| 51 | 51 | for($kota=1; $kota<=$countcity; $kota++){ |
| 52 | 52 | for ($index=0; $index<12; $index++) { |
| 53 | - $grafikcountepormascounter[$q][$kota][$index] = 0; |
|
| 54 | - $grafikbulanepormascounter[$q][$kota][$index] = 0; |
|
| 55 | - $grafiktotalepormascounter[$q][$kota][$index] = 0; |
|
| 56 | - $grafikpieepormascounter[$q][$kota][$index] = ['value'=>0,'name'=>$namaBulan[$index]]; |
|
| 57 | - $totaldatagrafikepormascounter[$q][$index] = 0; |
|
| 53 | + $grafikcountepormascounter[$q][$kota][$index] = 0; |
|
| 54 | + $grafikbulanepormascounter[$q][$kota][$index] = 0; |
|
| 55 | + $grafiktotalepormascounter[$q][$kota][$index] = 0; |
|
| 56 | + $grafikpieepormascounter[$q][$kota][$index] = ['value'=>0,'name'=>$namaBulan[$index]]; |
|
| 57 | + $totaldatagrafikepormascounter[$q][$index] = 0; |
|
| 58 | 58 | } |
| 59 | 59 | } |
| 60 | 60 | for($r=0; $r<$countgrafikepormascounter; $r++){ |
| 61 | - $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
|
| 62 | - $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
|
| 63 | - $city_id = $grafikepormascounter[$r]->city_id; |
|
| 64 | - if($bulansepormascounter < 10){ |
|
| 61 | + $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
|
| 62 | + $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
|
| 63 | + $city_id = $grafikepormascounter[$r]->city_id; |
|
| 64 | + if($bulansepormascounter < 10){ |
|
| 65 | 65 | $bulanepormascounter = substr($bulansepormascounter,1); |
| 66 | - }else { |
|
| 66 | + }else { |
|
| 67 | 67 | $bulanepormascounter = $bulansepormascounter; |
| 68 | - } |
|
| 69 | - if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
| 70 | - $totaldatagrafikepormascounter[$q][$bulanepormascounter-1] += $grafikepormascounter[$r]->count; |
|
| 71 | - } |
|
| 68 | + } |
|
| 69 | + if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
| 70 | + $totaldatagrafikepormascounter[$q][$bulanepormascounter-1] += $grafikepormascounter[$r]->count; |
|
| 71 | + } |
|
| 72 | 72 | } |
| 73 | 73 | for($r=0; $r<$countgrafikepormascounter; $r++){ |
| 74 | - $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
|
| 75 | - $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
|
| 76 | - $city_id = $grafikepormascounter[$r]->city_id; |
|
| 77 | - if($bulansepormascounter < 10){ |
|
| 74 | + $tahunsepormascounter = $grafikepormascounter[$r]->tahun; |
|
| 75 | + $bulansepormascounter = $grafikepormascounter[$r]->bulan; |
|
| 76 | + $city_id = $grafikepormascounter[$r]->city_id; |
|
| 77 | + if($bulansepormascounter < 10){ |
|
| 78 | 78 | $bulanepormascounter = substr($bulansepormascounter,1); |
| 79 | - }else { |
|
| 79 | + }else { |
|
| 80 | 80 | $bulanepormascounter = $bulansepormascounter; |
| 81 | - } |
|
| 82 | - if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
| 83 | - $grafikcountepormascounter[$q][$city_id][$bulanepormascounter-1] = (int)$grafikepormascounter[$r]->count; |
|
| 84 | - $grafikbulanepormascounter[$q][$city_id][$bulanepormascounter-1] = $grafikepormascounter[$r]->bulan; |
|
| 85 | - $totaldatagrafikepormascounters = $totaldatagrafikepormascounter[$q][$bulanepormascounter-1]; |
|
| 86 | - $grafiktotalepormascounter[$q][$city_id][$bulanepormascounter-1] = $totaldatagrafikepormascounters; |
|
| 87 | - $grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters,'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
| 88 | - } |
|
| 81 | + } |
|
| 82 | + if($tahungrafikepormascounter == $tahunsepormascounter){ |
|
| 83 | + $grafikcountepormascounter[$q][$city_id][$bulanepormascounter-1] = (int)$grafikepormascounter[$r]->count; |
|
| 84 | + $grafikbulanepormascounter[$q][$city_id][$bulanepormascounter-1] = $grafikepormascounter[$r]->bulan; |
|
| 85 | + $totaldatagrafikepormascounters = $totaldatagrafikepormascounter[$q][$bulanepormascounter-1]; |
|
| 86 | + $grafiktotalepormascounter[$q][$city_id][$bulanepormascounter-1] = $totaldatagrafikepormascounters; |
|
| 87 | + $grafikpieepormascounter[$q][$city_id][$bulanepormascounter-1] = ['value'=>$totaldatagrafikepormascounters,'name'=>$namaBulan[$bulanepormascounter-1]]; |
|
| 88 | + } |
|
| 89 | + } |
|
| 89 | 90 | } |
| 90 | - } |
|
| 91 | - $chartgrafikcountepormascounter = ['chartdata'=>$grafikcountepormascounter]; |
|
| 92 | - $datagrafikepormascounter = ['count'=>$grafikcountepormascounter, 'bulan'=>$grafikbulanepormascounter, 'namabulan'=>$namaBulan, 'namabulans'=>$namaBulans, 'kategori'=>$category, 'kota'=>$city, 'total'=>$grafiktotalepormascounter, 'datatahun'=>['tahun'=>$datagrafiktahunepormascounter, 'count'=>$datagrafikcountepormascounter, 'totaldata'=>$datagrafiktotalepormascounter], 'datapie'=>$grafikpieepormascounter, 'seriesdata'=>[$chartgrafikcountepormascounter]]; |
|
| 93 | - //end Pegawai Epormas |
|
| 91 | + $chartgrafikcountepormascounter = ['chartdata'=>$grafikcountepormascounter]; |
|
| 92 | + $datagrafikepormascounter = ['count'=>$grafikcountepormascounter, 'bulan'=>$grafikbulanepormascounter, 'namabulan'=>$namaBulan, 'namabulans'=>$namaBulans, 'kategori'=>$category, 'kota'=>$city, 'total'=>$grafiktotalepormascounter, 'datatahun'=>['tahun'=>$datagrafiktahunepormascounter, 'count'=>$datagrafikcountepormascounter, 'totaldata'=>$datagrafiktotalepormascounter], 'datapie'=>$grafikpieepormascounter, 'seriesdata'=>[$chartgrafikcountepormascounter]]; |
|
| 93 | + //end Pegawai Epormas |
|
| 94 | 94 | |
| 95 | 95 | return response()->json([ |
| 96 | 96 | //Jumlah Penduduk |
@@ -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 | } |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | $city_id = $grafikepormascounter[$r]->city_id; |
| 64 | 64 | if($bulansepormascounter < 10){ |
| 65 | 65 | $bulanepormascounter = substr($bulansepormascounter,1); |
| 66 | - }else { |
|
| 66 | + } else { |
|
| 67 | 67 | $bulanepormascounter = $bulansepormascounter; |
| 68 | 68 | } |
| 69 | 69 | if($tahungrafikepormascounter == $tahunsepormascounter){ |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | $city_id = $grafikepormascounter[$r]->city_id; |
| 77 | 77 | if($bulansepormascounter < 10){ |
| 78 | 78 | $bulanepormascounter = substr($bulansepormascounter,1); |
| 79 | - }else { |
|
| 79 | + } else { |
|
| 80 | 80 | $bulanepormascounter = $bulansepormascounter; |
| 81 | 81 | } |
| 82 | 82 | if($tahungrafikepormascounter == $tahunsepormascounter){ |
@@ -14,13 +14,13 @@ discard block |
||
| 14 | 14 | class EpormasCounterController extends Controller |
| 15 | 15 | {
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Display a listing of the resource. |
|
| 19 | - * |
|
| 20 | - * @return Response |
|
| 21 | - */ |
|
| 22 | - public function index() |
|
| 23 | - {
|
|
| 17 | + /** |
|
| 18 | + * Display a listing of the resource. |
|
| 19 | + * |
|
| 20 | + * @return Response |
|
| 21 | + */ |
|
| 22 | + public function index() |
|
| 23 | + {
|
|
| 24 | 24 | $result = EpormasCounter::whereNull('deleted_at')
|
| 25 | 25 | ->with('getCity')
|
| 26 | 26 | ->with('getCategory')
|
@@ -28,44 +28,44 @@ discard block |
||
| 28 | 28 | return response()->json([ |
| 29 | 29 | 'result' => $result |
| 30 | 30 | ]); |
| 31 | - } |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * Show the form for creating a new resource. |
|
| 35 | - * |
|
| 36 | - * @return Response |
|
| 37 | - */ |
|
| 38 | - public function create() |
|
| 39 | - {
|
|
| 33 | + /** |
|
| 34 | + * Show the form for creating a new resource. |
|
| 35 | + * |
|
| 36 | + * @return Response |
|
| 37 | + */ |
|
| 38 | + public function create() |
|
| 39 | + {
|
|
| 40 | 40 | $city = EpormasCity::all(); |
| 41 | 41 | $category = EpormasCategory::all(); |
| 42 | 42 | return response()->json([ |
| 43 | 43 | 'city' => $city, |
| 44 | 44 | 'category' => $category, |
| 45 | 45 | ]); |
| 46 | - } |
|
| 46 | + } |
|
| 47 | 47 | |
| 48 | - /** |
|
| 49 | - * Store a newly created resource in storage. |
|
| 50 | - * |
|
| 51 | - * @return Response |
|
| 52 | - */ |
|
| 53 | - public function store(Request $request, $version='') |
|
| 54 | - {
|
|
| 48 | + /** |
|
| 49 | + * Store a newly created resource in storage. |
|
| 50 | + * |
|
| 51 | + * @return Response |
|
| 52 | + */ |
|
| 53 | + public function store(Request $request, $version='') |
|
| 54 | + {
|
|
| 55 | 55 | $path = \Request::path(); |
| 56 | 56 | $explode = explode('/', $path);
|
| 57 | 57 | |
| 58 | 58 | $from = 'form'; |
| 59 | 59 | if(in_array('api',$explode)){
|
| 60 | - $from = 'api'; |
|
| 60 | + $from = 'api'; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $via = $from; |
| 64 | 64 | if($version != '' && $version != 'store'){
|
| 65 | - $via .= '-'.$version; |
|
| 65 | + $via .= '-'.$version; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $rules = [ |
|
| 68 | + $rules = [ |
|
| 69 | 69 | 'count' => 'required|numeric', |
| 70 | 70 | 'city_id' => 'required|numeric', |
| 71 | 71 | 'category_id' => 'required|numeric', |
@@ -74,44 +74,44 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | $validator = Validator::make($request->all(), $rules); |
| 76 | 76 | if ($validator->fails()) {
|
| 77 | - return response()->json([ |
|
| 78 | - 'title' => 'Error', |
|
| 79 | - 'type' => 'error', |
|
| 80 | - 'message' => $validator->errors()->all() |
|
| 81 | - ]); |
|
| 77 | + return response()->json([ |
|
| 78 | + 'title' => 'Error', |
|
| 79 | + 'type' => 'error', |
|
| 80 | + 'message' => $validator->errors()->all() |
|
| 81 | + ]); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
| 85 | 85 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 86 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 87 | - ->where('category_id',$request->category_id)
|
|
| 88 | - ->where('city_id',$request->city_id)
|
|
| 89 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 90 | - ->orderBy('bulan')
|
|
| 91 | - ->count(); |
|
| 86 | + ->where('tanggal','like','%'.$format.'%')
|
|
| 87 | + ->where('category_id',$request->category_id)
|
|
| 88 | + ->where('city_id',$request->city_id)
|
|
| 89 | + ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 90 | + ->orderBy('bulan')
|
|
| 91 | + ->count(); |
|
| 92 | 92 | if($resultcek > 0){
|
| 93 | - return response()->json([ |
|
| 94 | - 'title' => 'Error', |
|
| 95 | - 'type' => 'error', |
|
| 96 | - 'message' => 'Data has already been taken.' |
|
| 97 | - ]); |
|
| 93 | + return response()->json([ |
|
| 94 | + 'title' => 'Error', |
|
| 95 | + 'type' => 'error', |
|
| 96 | + 'message' => 'Data has already been taken.' |
|
| 97 | + ]); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | $date = explode("-",$format);
|
| 101 | 101 | $data = EpormasCounter::whereNull('deleted_at')
|
| 102 | - ->where('tahun', $date[0])
|
|
| 103 | - ->where('bulan', $date[1])
|
|
| 104 | - ->where('category_id',$request->category_id)
|
|
| 105 | - ->where('city_id',$request->city_id)
|
|
| 106 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 107 | - ->orderBy('bulan')
|
|
| 108 | - ->count(); |
|
| 102 | + ->where('tahun', $date[0])
|
|
| 103 | + ->where('bulan', $date[1])
|
|
| 104 | + ->where('category_id',$request->category_id)
|
|
| 105 | + ->where('city_id',$request->city_id)
|
|
| 106 | + ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 107 | + ->orderBy('bulan')
|
|
| 108 | + ->count(); |
|
| 109 | 109 | if($data > 0){
|
| 110 | - return response()->json([ |
|
| 111 | - 'title' => 'Error', |
|
| 112 | - 'type' => 'error', |
|
| 113 | - 'message' => 'Data has already been taken.' |
|
| 114 | - ]); |
|
| 110 | + return response()->json([ |
|
| 111 | + 'title' => 'Error', |
|
| 112 | + 'type' => 'error', |
|
| 113 | + 'message' => 'Data has already been taken.' |
|
| 114 | + ]); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | $result = EpormasCounter::create([ |
@@ -130,16 +130,16 @@ discard block |
||
| 130 | 130 | 'type' => 'success', |
| 131 | 131 | 'message' => 'Data created successfully' |
| 132 | 132 | ]); |
| 133 | - } |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - /** |
|
| 136 | - * Display the specified resource. |
|
| 137 | - * |
|
| 138 | - * @param int $id |
|
| 139 | - * @return Response |
|
| 140 | - */ |
|
| 141 | - public function show($version='', $id) |
|
| 142 | - {
|
|
| 135 | + /** |
|
| 136 | + * Display the specified resource. |
|
| 137 | + * |
|
| 138 | + * @param int $id |
|
| 139 | + * @return Response |
|
| 140 | + */ |
|
| 141 | + public function show($version='', $id) |
|
| 142 | + {
|
|
| 143 | 143 | $result = EpormasCounter::whereNull('deleted_at')
|
| 144 | 144 | ->with('getCity')
|
| 145 | 145 | ->with('getCategory')
|
@@ -147,16 +147,16 @@ discard block |
||
| 147 | 147 | return response()->json([ |
| 148 | 148 | 'result' => $result |
| 149 | 149 | ]); |
| 150 | - } |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - /** |
|
| 153 | - * Show the form for editing the specified resource. |
|
| 154 | - * |
|
| 155 | - * @param int $id |
|
| 156 | - * @return Response |
|
| 157 | - */ |
|
| 158 | - public function edit($id) |
|
| 159 | - {
|
|
| 152 | + /** |
|
| 153 | + * Show the form for editing the specified resource. |
|
| 154 | + * |
|
| 155 | + * @param int $id |
|
| 156 | + * @return Response |
|
| 157 | + */ |
|
| 158 | + public function edit($id) |
|
| 159 | + {
|
|
| 160 | 160 | $city = EpormasCity::all(); |
| 161 | 161 | $category = EpormasCategory::all(); |
| 162 | 162 | $result = EpormasCounter::whereNull('deleted_at')
|
@@ -170,16 +170,16 @@ discard block |
||
| 170 | 170 | 'tanggal' => $format, |
| 171 | 171 | 'category' => $category, |
| 172 | 172 | ]); |
| 173 | - } |
|
| 173 | + } |
|
| 174 | 174 | |
| 175 | - /** |
|
| 176 | - * Update the specified resource in storage. |
|
| 177 | - * |
|
| 178 | - * @param int $id |
|
| 179 | - * @return Response |
|
| 180 | - */ |
|
| 181 | - public function update(Request $request, $version='', $id) |
|
| 182 | - {
|
|
| 175 | + /** |
|
| 176 | + * Update the specified resource in storage. |
|
| 177 | + * |
|
| 178 | + * @param int $id |
|
| 179 | + * @return Response |
|
| 180 | + */ |
|
| 181 | + public function update(Request $request, $version='', $id) |
|
| 182 | + {
|
|
| 183 | 183 | $result = EpormasCounter::whereNull('deleted_at')
|
| 184 | 184 | ->with('getCity')
|
| 185 | 185 | ->with('getCategory')
|
@@ -194,28 +194,28 @@ discard block |
||
| 194 | 194 | |
| 195 | 195 | $validator = Validator::make($request->all(), $rules); |
| 196 | 196 | if ($validator->fails()) {
|
| 197 | - return response()->json([ |
|
| 198 | - 'title' => 'Error', |
|
| 199 | - 'type' => 'error', |
|
| 200 | - 'message' => $validator->errors()->all() |
|
| 201 | - ]); |
|
| 197 | + return response()->json([ |
|
| 198 | + 'title' => 'Error', |
|
| 199 | + 'type' => 'error', |
|
| 200 | + 'message' => $validator->errors()->all() |
|
| 201 | + ]); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
| 205 | 205 | if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
|
| 206 | 206 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 207 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 208 | - ->where('category_id',$request->category_id)
|
|
| 209 | - ->where('city_id',$request->city_id)
|
|
| 210 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 211 | - ->orderBy('bulan')
|
|
| 212 | - ->count(); |
|
| 207 | + ->where('tanggal','like','%'.$format.'%')
|
|
| 208 | + ->where('category_id',$request->category_id)
|
|
| 209 | + ->where('city_id',$request->city_id)
|
|
| 210 | + ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 211 | + ->orderBy('bulan')
|
|
| 212 | + ->count(); |
|
| 213 | 213 | if($resultcek > 0){
|
| 214 | - return response()->json([ |
|
| 215 | - 'title' => 'Error', |
|
| 216 | - 'type' => 'error', |
|
| 217 | - 'message' => 'Data has already been taken.' |
|
| 218 | - ]); |
|
| 214 | + return response()->json([ |
|
| 215 | + 'title' => 'Error', |
|
| 216 | + 'type' => 'error', |
|
| 217 | + 'message' => 'Data has already been taken.' |
|
| 218 | + ]); |
|
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
@@ -223,34 +223,34 @@ discard block |
||
| 223 | 223 | $dates = date('Y-m-d', strtotime($result->tanggal));
|
| 224 | 224 | if($dates != $format){
|
| 225 | 225 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 226 | - ->where('category_id',$request->category_id)
|
|
| 227 | - ->where('city_id',$request->city_id)
|
|
| 228 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 229 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 230 | - ->orderBy('bulan')
|
|
| 231 | - ->count(); |
|
| 226 | + ->where('category_id',$request->category_id)
|
|
| 227 | + ->where('city_id',$request->city_id)
|
|
| 228 | + ->where('tanggal','like','%'.$format.'%')
|
|
| 229 | + ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 230 | + ->orderBy('bulan')
|
|
| 231 | + ->count(); |
|
| 232 | 232 | if($resultcek > 0){
|
| 233 | - return response()->json([ |
|
| 234 | - 'title' => 'Error', |
|
| 235 | - 'type' => 'error', |
|
| 236 | - 'message' => 'Data has already been taken.' |
|
| 237 | - ]); |
|
| 233 | + return response()->json([ |
|
| 234 | + 'title' => 'Error', |
|
| 235 | + 'type' => 'error', |
|
| 236 | + 'message' => 'Data has already been taken.' |
|
| 237 | + ]); |
|
| 238 | 238 | } |
| 239 | 239 | |
| 240 | 240 | $data = EpormasCounter::whereNull('deleted_at')
|
| 241 | - ->where('tahun', $date[0])
|
|
| 242 | - ->where('bulan', $date[1])
|
|
| 243 | - ->where('category_id',$request->category_id)
|
|
| 244 | - ->where('city_id',$request->city_id)
|
|
| 245 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 246 | - ->orderBy('bulan')
|
|
| 247 | - ->count(); |
|
| 241 | + ->where('tahun', $date[0])
|
|
| 242 | + ->where('bulan', $date[1])
|
|
| 243 | + ->where('category_id',$request->category_id)
|
|
| 244 | + ->where('city_id',$request->city_id)
|
|
| 245 | + ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 246 | + ->orderBy('bulan')
|
|
| 247 | + ->count(); |
|
| 248 | 248 | if($data > 0){
|
| 249 | - return response()->json([ |
|
| 250 | - 'title' => 'Error', |
|
| 251 | - 'type' => 'error', |
|
| 252 | - 'message' => 'Data has already been taken.' |
|
| 253 | - ]); |
|
| 249 | + return response()->json([ |
|
| 250 | + 'title' => 'Error', |
|
| 251 | + 'type' => 'error', |
|
| 252 | + 'message' => 'Data has already been taken.' |
|
| 253 | + ]); |
|
| 254 | 254 | } |
| 255 | 255 | } |
| 256 | 256 | |
@@ -260,13 +260,13 @@ discard block |
||
| 260 | 260 | $from = $result->via; |
| 261 | 261 | $user_id = $result->user_id; |
| 262 | 262 | if(in_array('api',$explode)){
|
| 263 | - $from = 'api'; |
|
| 264 | - $user_id = $request->user_id; |
|
| 263 | + $from = 'api'; |
|
| 264 | + $user_id = $request->user_id; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | $via = $from; |
| 268 | 268 | if($version != '' && $version != 'update'){
|
| 269 | - $via .= '-'.$version; |
|
| 269 | + $via .= '-'.$version; |
|
| 270 | 270 | } |
| 271 | 271 | |
| 272 | 272 | $result->update([ |
@@ -285,21 +285,21 @@ discard block |
||
| 285 | 285 | 'type' => 'success', |
| 286 | 286 | 'message' => 'Data updated successfully' |
| 287 | 287 | ]); |
| 288 | - } |
|
| 288 | + } |
|
| 289 | 289 | |
| 290 | - /** |
|
| 291 | - * Remove the specified resource from storage. |
|
| 292 | - * |
|
| 293 | - * @param int $id |
|
| 294 | - * @return Response |
|
| 295 | - */ |
|
| 296 | - public function destroy($id) |
|
| 297 | - {
|
|
| 290 | + /** |
|
| 291 | + * Remove the specified resource from storage. |
|
| 292 | + * |
|
| 293 | + * @param int $id |
|
| 294 | + * @return Response |
|
| 295 | + */ |
|
| 296 | + public function destroy($id) |
|
| 297 | + {
|
|
| 298 | 298 | EpormasCounter::find($id)->delete(); |
| 299 | 299 | return response()->json([ |
| 300 | 300 | 'message' => 'Data deleted successfully' |
| 301 | 301 | ]); |
| 302 | - } |
|
| 302 | + } |
|
| 303 | 303 | |
| 304 | 304 | } |
| 305 | 305 | |
@@ -50,18 +50,18 @@ discard block |
||
| 50 | 50 | * |
| 51 | 51 | * @return Response |
| 52 | 52 | */ |
| 53 | - public function store(Request $request, $version='') |
|
| 53 | + public function store(Request $request, $version = '') |
|
| 54 | 54 | {
|
| 55 | 55 | $path = \Request::path(); |
| 56 | 56 | $explode = explode('/', $path);
|
| 57 | 57 | |
| 58 | 58 | $from = 'form'; |
| 59 | - if(in_array('api',$explode)){
|
|
| 59 | + if (in_array('api', $explode)) {
|
|
| 60 | 60 | $from = 'api'; |
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $via = $from; |
| 64 | - if($version != '' && $version != 'store'){
|
|
| 64 | + if ($version != '' && $version != 'store') {
|
|
| 65 | 65 | $via .= '-'.$version; |
| 66 | 66 | } |
| 67 | 67 | |
@@ -81,15 +81,15 @@ discard block |
||
| 81 | 81 | ]); |
| 82 | 82 | } |
| 83 | 83 | |
| 84 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
|
| 84 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
|
|
| 85 | 85 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 86 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 87 | - ->where('category_id',$request->category_id)
|
|
| 88 | - ->where('city_id',$request->city_id)
|
|
| 89 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 86 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 87 | + ->where('category_id', $request->category_id)
|
|
| 88 | + ->where('city_id', $request->city_id)
|
|
| 89 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 90 | 90 | ->orderBy('bulan')
|
| 91 | 91 | ->count(); |
| 92 | - if($resultcek > 0){
|
|
| 92 | + if ($resultcek > 0) {
|
|
| 93 | 93 | return response()->json([ |
| 94 | 94 | 'title' => 'Error', |
| 95 | 95 | 'type' => 'error', |
@@ -97,16 +97,16 @@ discard block |
||
| 97 | 97 | ]); |
| 98 | 98 | } |
| 99 | 99 | |
| 100 | - $date = explode("-",$format);
|
|
| 100 | + $date = explode("-", $format);
|
|
| 101 | 101 | $data = EpormasCounter::whereNull('deleted_at')
|
| 102 | 102 | ->where('tahun', $date[0])
|
| 103 | 103 | ->where('bulan', $date[1])
|
| 104 | - ->where('category_id',$request->category_id)
|
|
| 105 | - ->where('city_id',$request->city_id)
|
|
| 106 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 104 | + ->where('category_id', $request->category_id)
|
|
| 105 | + ->where('city_id', $request->city_id)
|
|
| 106 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 107 | 107 | ->orderBy('bulan')
|
| 108 | 108 | ->count(); |
| 109 | - if($data > 0){
|
|
| 109 | + if ($data > 0) {
|
|
| 110 | 110 | return response()->json([ |
| 111 | 111 | 'title' => 'Error', |
| 112 | 112 | 'type' => 'error', |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @param int $id |
| 139 | 139 | * @return Response |
| 140 | 140 | */ |
| 141 | - public function show($version='', $id) |
|
| 141 | + public function show($version = '', $id) |
|
| 142 | 142 | {
|
| 143 | 143 | $result = EpormasCounter::whereNull('deleted_at')
|
| 144 | 144 | ->with('getCity')
|
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @param int $id |
| 179 | 179 | * @return Response |
| 180 | 180 | */ |
| 181 | - public function update(Request $request, $version='', $id) |
|
| 181 | + public function update(Request $request, $version = '', $id) |
|
| 182 | 182 | {
|
| 183 | 183 | $result = EpormasCounter::whereNull('deleted_at')
|
| 184 | 184 | ->with('getCity')
|
@@ -201,16 +201,16 @@ discard block |
||
| 201 | 201 | ]); |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - $format = date('Y-m-d', strtotime(str_replace(' ','-',$request->tanggal)));
|
|
| 205 | - if($result->city_id != $request->city_id || $result->category_id != $request->category_id){
|
|
| 204 | + $format = date('Y-m-d', strtotime(str_replace(' ', '-', $request->tanggal)));
|
|
| 205 | + if ($result->city_id != $request->city_id || $result->category_id != $request->category_id) {
|
|
| 206 | 206 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 207 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 208 | - ->where('category_id',$request->category_id)
|
|
| 209 | - ->where('city_id',$request->city_id)
|
|
| 210 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 207 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 208 | + ->where('category_id', $request->category_id)
|
|
| 209 | + ->where('city_id', $request->city_id)
|
|
| 210 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 211 | 211 | ->orderBy('bulan')
|
| 212 | 212 | ->count(); |
| 213 | - if($resultcek > 0){
|
|
| 213 | + if ($resultcek > 0) {
|
|
| 214 | 214 | return response()->json([ |
| 215 | 215 | 'title' => 'Error', |
| 216 | 216 | 'type' => 'error', |
@@ -219,17 +219,17 @@ discard block |
||
| 219 | 219 | } |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | - $date = explode("-",$format);
|
|
| 222 | + $date = explode("-", $format);
|
|
| 223 | 223 | $dates = date('Y-m-d', strtotime($result->tanggal));
|
| 224 | - if($dates != $format){
|
|
| 224 | + if ($dates != $format) {
|
|
| 225 | 225 | $resultcek = EpormasCounter::whereNull('deleted_at')
|
| 226 | - ->where('category_id',$request->category_id)
|
|
| 227 | - ->where('city_id',$request->city_id)
|
|
| 228 | - ->where('tanggal','like','%'.$format.'%')
|
|
| 229 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 226 | + ->where('category_id', $request->category_id)
|
|
| 227 | + ->where('city_id', $request->city_id)
|
|
| 228 | + ->where('tanggal', 'like', '%'.$format.'%')
|
|
| 229 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 230 | 230 | ->orderBy('bulan')
|
| 231 | 231 | ->count(); |
| 232 | - if($resultcek > 0){
|
|
| 232 | + if ($resultcek > 0) {
|
|
| 233 | 233 | return response()->json([ |
| 234 | 234 | 'title' => 'Error', |
| 235 | 235 | 'type' => 'error', |
@@ -240,12 +240,12 @@ discard block |
||
| 240 | 240 | $data = EpormasCounter::whereNull('deleted_at')
|
| 241 | 241 | ->where('tahun', $date[0])
|
| 242 | 242 | ->where('bulan', $date[1])
|
| 243 | - ->where('category_id',$request->category_id)
|
|
| 244 | - ->where('city_id',$request->city_id)
|
|
| 245 | - ->groupBy('tahun','bulan','category_id','city_id')
|
|
| 243 | + ->where('category_id', $request->category_id)
|
|
| 244 | + ->where('city_id', $request->city_id)
|
|
| 245 | + ->groupBy('tahun', 'bulan', 'category_id', 'city_id')
|
|
| 246 | 246 | ->orderBy('bulan')
|
| 247 | 247 | ->count(); |
| 248 | - if($data > 0){
|
|
| 248 | + if ($data > 0) {
|
|
| 249 | 249 | return response()->json([ |
| 250 | 250 | 'title' => 'Error', |
| 251 | 251 | 'type' => 'error', |
@@ -259,13 +259,13 @@ discard block |
||
| 259 | 259 | |
| 260 | 260 | $from = $result->via; |
| 261 | 261 | $user_id = $result->user_id; |
| 262 | - if(in_array('api',$explode)){
|
|
| 262 | + if (in_array('api', $explode)) {
|
|
| 263 | 263 | $from = 'api'; |
| 264 | 264 | $user_id = $request->user_id; |
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | $via = $from; |
| 268 | - if($version != '' && $version != 'update'){
|
|
| 268 | + if ($version != '' && $version != 'update') {
|
|
| 269 | 269 | $via .= '-'.$version; |
| 270 | 270 | } |
| 271 | 271 | |
@@ -12,71 +12,71 @@ discard block |
||
| 12 | 12 | class EpormasCategoryController extends Controller |
| 13 | 13 | {
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Display a listing of the resource. |
|
| 17 | - * |
|
| 18 | - * @return Response |
|
| 19 | - */ |
|
| 20 | - public function index() |
|
| 21 | - {
|
|
| 15 | + /** |
|
| 16 | + * Display a listing of the resource. |
|
| 17 | + * |
|
| 18 | + * @return Response |
|
| 19 | + */ |
|
| 20 | + public function index() |
|
| 21 | + {
|
|
| 22 | 22 | $result = EpormasCategory::all(); |
| 23 | 23 | return response()->json([ |
| 24 | 24 | 'result' => $result |
| 25 | 25 | ]); |
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Show the form for creating a new resource. |
|
| 30 | - * |
|
| 31 | - * @return Response |
|
| 32 | - */ |
|
| 33 | - public function create() |
|
| 34 | - {
|
|
| 35 | - |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Store a newly created resource in storage. |
|
| 40 | - * |
|
| 41 | - * @return Response |
|
| 42 | - */ |
|
| 43 | - public function store(Request $request, $version='') |
|
| 44 | - {
|
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Show the form for creating a new resource. |
|
| 30 | + * |
|
| 31 | + * @return Response |
|
| 32 | + */ |
|
| 33 | + public function create() |
|
| 34 | + {
|
|
| 35 | + |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Store a newly created resource in storage. |
|
| 40 | + * |
|
| 41 | + * @return Response |
|
| 42 | + */ |
|
| 43 | + public function store(Request $request, $version='') |
|
| 44 | + {
|
|
| 45 | 45 | $path = \Request::path(); |
| 46 | 46 | $explode = explode('/', $path);
|
| 47 | 47 | |
| 48 | 48 | $from = 'form'; |
| 49 | 49 | if(in_array('api',$explode)){
|
| 50 | - $from = 'api'; |
|
| 50 | + $from = 'api'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $via = $from; |
| 54 | 54 | if($version != '' && $version != 'store'){
|
| 55 | - $via .= '-'.$version; |
|
| 55 | + $via .= '-'.$version; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $rules = [ |
|
| 58 | + $rules = [ |
|
| 59 | 59 | 'name' => 'required' |
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | 62 | $validator = Validator::make($request->all(), $rules); |
| 63 | 63 | if ($validator->fails()) {
|
| 64 | - return response()->json([ |
|
| 65 | - 'title' => 'Error', |
|
| 66 | - 'type' => 'error', |
|
| 67 | - 'message' => $validator->errors()->all() |
|
| 68 | - ]); |
|
| 64 | + return response()->json([ |
|
| 65 | + 'title' => 'Error', |
|
| 66 | + 'type' => 'error', |
|
| 67 | + 'message' => $validator->errors()->all() |
|
| 68 | + ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $data = EpormasCategory::whereNull('deleted_at')
|
| 72 | 72 | ->where('name', $request->name)
|
| 73 | 73 | ->count(); |
| 74 | 74 | if($data > 0){
|
| 75 | - return response()->json([ |
|
| 76 | - 'title' => 'Error', |
|
| 77 | - 'type' => 'error', |
|
| 78 | - 'message' => 'Data has already been taken.' |
|
| 79 | - ]); |
|
| 75 | + return response()->json([ |
|
| 76 | + 'title' => 'Error', |
|
| 77 | + 'type' => 'error', |
|
| 78 | + 'message' => 'Data has already been taken.' |
|
| 79 | + ]); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $result = EpormasCategory::create([ |
@@ -88,44 +88,44 @@ discard block |
||
| 88 | 88 | 'type' => 'success', |
| 89 | 89 | 'message' => 'Data created successfully' |
| 90 | 90 | ]); |
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Display the specified resource. |
|
| 95 | - * |
|
| 96 | - * @param int $id |
|
| 97 | - * @return Response |
|
| 98 | - */ |
|
| 99 | - public function show($version='', $id) |
|
| 100 | - {
|
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Display the specified resource. |
|
| 95 | + * |
|
| 96 | + * @param int $id |
|
| 97 | + * @return Response |
|
| 98 | + */ |
|
| 99 | + public function show($version='', $id) |
|
| 100 | + {
|
|
| 101 | 101 | $result = EpormasCategory::find($id); |
| 102 | 102 | return response()->json([ |
| 103 | 103 | 'result' => $result |
| 104 | 104 | ]); |
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Show the form for editing the specified resource. |
|
| 109 | - * |
|
| 110 | - * @param int $id |
|
| 111 | - * @return Response |
|
| 112 | - */ |
|
| 113 | - public function edit($id) |
|
| 114 | - {
|
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Show the form for editing the specified resource. |
|
| 109 | + * |
|
| 110 | + * @param int $id |
|
| 111 | + * @return Response |
|
| 112 | + */ |
|
| 113 | + public function edit($id) |
|
| 114 | + {
|
|
| 115 | 115 | $result = EpormasCategory::find($id); |
| 116 | 116 | return response()->json([ |
| 117 | 117 | 'result' => $result |
| 118 | 118 | ]); |
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Update the specified resource in storage. |
|
| 123 | - * |
|
| 124 | - * @param int $id |
|
| 125 | - * @return Response |
|
| 126 | - */ |
|
| 127 | - public function update(Request $request, $version='', $id) |
|
| 128 | - {
|
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Update the specified resource in storage. |
|
| 123 | + * |
|
| 124 | + * @param int $id |
|
| 125 | + * @return Response |
|
| 126 | + */ |
|
| 127 | + public function update(Request $request, $version='', $id) |
|
| 128 | + {
|
|
| 129 | 129 | $result = EpormasCategory::find($id); |
| 130 | 130 | |
| 131 | 131 | $rules = [ |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $validator = Validator::make($request->all(), $rules); |
| 136 | 136 | if ($validator->fails()) {
|
| 137 | - return response()->json([ |
|
| 138 | - 'title' => 'Error', |
|
| 139 | - 'type' => 'error', |
|
| 140 | - 'message' => $validator->errors()->all() |
|
| 141 | - ]); |
|
| 137 | + return response()->json([ |
|
| 138 | + 'title' => 'Error', |
|
| 139 | + 'type' => 'error', |
|
| 140 | + 'message' => $validator->errors()->all() |
|
| 141 | + ]); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if($request->name != $result->name){
|
| 145 | - $data = EpormasCategory::whereNull('deleted_at')
|
|
| 146 | - ->where('name', $request->name)
|
|
| 147 | - ->count(); |
|
| 148 | - if($data > 0){
|
|
| 145 | + $data = EpormasCategory::whereNull('deleted_at')
|
|
| 146 | + ->where('name', $request->name)
|
|
| 147 | + ->count(); |
|
| 148 | + if($data > 0){
|
|
| 149 | 149 | return response()->json([ |
| 150 | 150 | 'title' => 'Error', |
| 151 | 151 | 'type' => 'error', |
| 152 | 152 | 'message' => 'Data has already been taken.' |
| 153 | 153 | ]); |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $path = \Request::path(); |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $from = 'form'; |
| 161 | 161 | if(in_array('api',$explode)){
|
| 162 | - $from = 'api'; |
|
| 162 | + $from = 'api'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $via = $from; |
| 166 | 166 | if($version != '' && $version != 'update'){
|
| 167 | - $via .= '-'.$version; |
|
| 167 | + $via .= '-'.$version; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $result->update([ |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | 'type' => 'success', |
| 177 | 177 | 'message' => 'Data updated successfully' |
| 178 | 178 | ]); |
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Remove the specified resource from storage. |
|
| 183 | - * |
|
| 184 | - * @param int $id |
|
| 185 | - * @return Response |
|
| 186 | - */ |
|
| 187 | - public function destroy($id) |
|
| 188 | - {
|
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Remove the specified resource from storage. |
|
| 183 | + * |
|
| 184 | + * @param int $id |
|
| 185 | + * @return Response |
|
| 186 | + */ |
|
| 187 | + public function destroy($id) |
|
| 188 | + {
|
|
| 189 | 189 | EpormasCategory::find($id)->delete(); |
| 190 | 190 | return response()->json([ |
| 191 | 191 | 'message' => 'Data deleted successfully' |
| 192 | 192 | ]); |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | } |
| 196 | 196 | |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return Response |
| 42 | 42 | */ |
| 43 | - public function store(Request $request, $version='') |
|
| 43 | + public function store(Request $request, $version = '') |
|
| 44 | 44 | {
|
| 45 | 45 | $path = \Request::path(); |
| 46 | 46 | $explode = explode('/', $path);
|
| 47 | 47 | |
| 48 | 48 | $from = 'form'; |
| 49 | - if(in_array('api',$explode)){
|
|
| 49 | + if (in_array('api', $explode)) {
|
|
| 50 | 50 | $from = 'api'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $via = $from; |
| 54 | - if($version != '' && $version != 'store'){
|
|
| 54 | + if ($version != '' && $version != 'store') {
|
|
| 55 | 55 | $via .= '-'.$version; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $data = EpormasCategory::whereNull('deleted_at')
|
| 72 | 72 | ->where('name', $request->name)
|
| 73 | 73 | ->count(); |
| 74 | - if($data > 0){
|
|
| 74 | + if ($data > 0) {
|
|
| 75 | 75 | return response()->json([ |
| 76 | 76 | 'title' => 'Error', |
| 77 | 77 | 'type' => 'error', |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param int $id |
| 97 | 97 | * @return Response |
| 98 | 98 | */ |
| 99 | - public function show($version='', $id) |
|
| 99 | + public function show($version = '', $id) |
|
| 100 | 100 | {
|
| 101 | 101 | $result = EpormasCategory::find($id); |
| 102 | 102 | return response()->json([ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param int $id |
| 125 | 125 | * @return Response |
| 126 | 126 | */ |
| 127 | - public function update(Request $request, $version='', $id) |
|
| 127 | + public function update(Request $request, $version = '', $id) |
|
| 128 | 128 | {
|
| 129 | 129 | $result = EpormasCategory::find($id); |
| 130 | 130 | |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | ]); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if($request->name != $result->name){
|
|
| 144 | + if ($request->name != $result->name) {
|
|
| 145 | 145 | $data = EpormasCategory::whereNull('deleted_at')
|
| 146 | 146 | ->where('name', $request->name)
|
| 147 | 147 | ->count(); |
| 148 | - if($data > 0){
|
|
| 148 | + if ($data > 0) {
|
|
| 149 | 149 | return response()->json([ |
| 150 | 150 | 'title' => 'Error', |
| 151 | 151 | 'type' => 'error', |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | $explode = explode('/', $path);
|
| 159 | 159 | |
| 160 | 160 | $from = 'form'; |
| 161 | - if(in_array('api',$explode)){
|
|
| 161 | + if (in_array('api', $explode)) {
|
|
| 162 | 162 | $from = 'api'; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $via = $from; |
| 166 | - if($version != '' && $version != 'update'){
|
|
| 166 | + if ($version != '' && $version != 'update') {
|
|
| 167 | 167 | $via .= '-'.$version; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -12,71 +12,71 @@ discard block |
||
| 12 | 12 | class EpormasCityController extends Controller |
| 13 | 13 | {
|
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Display a listing of the resource. |
|
| 17 | - * |
|
| 18 | - * @return Response |
|
| 19 | - */ |
|
| 20 | - public function index() |
|
| 21 | - {
|
|
| 15 | + /** |
|
| 16 | + * Display a listing of the resource. |
|
| 17 | + * |
|
| 18 | + * @return Response |
|
| 19 | + */ |
|
| 20 | + public function index() |
|
| 21 | + {
|
|
| 22 | 22 | $result = EpormasCity::all(); |
| 23 | 23 | return response()->json([ |
| 24 | 24 | 'result' => $result |
| 25 | 25 | ]); |
| 26 | - } |
|
| 27 | - |
|
| 28 | - /** |
|
| 29 | - * Show the form for creating a new resource. |
|
| 30 | - * |
|
| 31 | - * @return Response |
|
| 32 | - */ |
|
| 33 | - public function create() |
|
| 34 | - {
|
|
| 35 | - |
|
| 36 | - } |
|
| 37 | - |
|
| 38 | - /** |
|
| 39 | - * Store a newly created resource in storage. |
|
| 40 | - * |
|
| 41 | - * @return Response |
|
| 42 | - */ |
|
| 43 | - public function store(Request $request, $version='') |
|
| 44 | - {
|
|
| 26 | + } |
|
| 27 | + |
|
| 28 | + /** |
|
| 29 | + * Show the form for creating a new resource. |
|
| 30 | + * |
|
| 31 | + * @return Response |
|
| 32 | + */ |
|
| 33 | + public function create() |
|
| 34 | + {
|
|
| 35 | + |
|
| 36 | + } |
|
| 37 | + |
|
| 38 | + /** |
|
| 39 | + * Store a newly created resource in storage. |
|
| 40 | + * |
|
| 41 | + * @return Response |
|
| 42 | + */ |
|
| 43 | + public function store(Request $request, $version='') |
|
| 44 | + {
|
|
| 45 | 45 | $path = \Request::path(); |
| 46 | 46 | $explode = explode('/', $path);
|
| 47 | 47 | |
| 48 | 48 | $from = 'form'; |
| 49 | 49 | if(in_array('api',$explode)){
|
| 50 | - $from = 'api'; |
|
| 50 | + $from = 'api'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $via = $from; |
| 54 | 54 | if($version != '' && $version != 'store'){
|
| 55 | - $via .= '-'.$version; |
|
| 55 | + $via .= '-'.$version; |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | - $rules = [ |
|
| 58 | + $rules = [ |
|
| 59 | 59 | 'name' => 'required' |
| 60 | 60 | ]; |
| 61 | 61 | |
| 62 | 62 | $validator = Validator::make($request->all(), $rules); |
| 63 | 63 | if ($validator->fails()) {
|
| 64 | - return response()->json([ |
|
| 65 | - 'title' => 'Error', |
|
| 66 | - 'type' => 'error', |
|
| 67 | - 'message' => $validator->errors()->all() |
|
| 68 | - ]); |
|
| 64 | + return response()->json([ |
|
| 65 | + 'title' => 'Error', |
|
| 66 | + 'type' => 'error', |
|
| 67 | + 'message' => $validator->errors()->all() |
|
| 68 | + ]); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | $data = EpormasCity::whereNull('deleted_at')
|
| 72 | 72 | ->where('name', $request->name)
|
| 73 | 73 | ->count(); |
| 74 | 74 | if($data > 0){
|
| 75 | - return response()->json([ |
|
| 76 | - 'title' => 'Error', |
|
| 77 | - 'type' => 'error', |
|
| 78 | - 'message' => 'Data has already been taken.' |
|
| 79 | - ]); |
|
| 75 | + return response()->json([ |
|
| 76 | + 'title' => 'Error', |
|
| 77 | + 'type' => 'error', |
|
| 78 | + 'message' => 'Data has already been taken.' |
|
| 79 | + ]); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | $result = EpormasCity::create([ |
@@ -88,44 +88,44 @@ discard block |
||
| 88 | 88 | 'type' => 'success', |
| 89 | 89 | 'message' => 'Data created successfully' |
| 90 | 90 | ]); |
| 91 | - } |
|
| 92 | - |
|
| 93 | - /** |
|
| 94 | - * Display the specified resource. |
|
| 95 | - * |
|
| 96 | - * @param int $id |
|
| 97 | - * @return Response |
|
| 98 | - */ |
|
| 99 | - public function show($version='', $id) |
|
| 100 | - {
|
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + /** |
|
| 94 | + * Display the specified resource. |
|
| 95 | + * |
|
| 96 | + * @param int $id |
|
| 97 | + * @return Response |
|
| 98 | + */ |
|
| 99 | + public function show($version='', $id) |
|
| 100 | + {
|
|
| 101 | 101 | $result = EpormasCity::find($id); |
| 102 | 102 | return response()->json([ |
| 103 | 103 | 'result' => $result |
| 104 | 104 | ]); |
| 105 | - } |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * Show the form for editing the specified resource. |
|
| 109 | - * |
|
| 110 | - * @param int $id |
|
| 111 | - * @return Response |
|
| 112 | - */ |
|
| 113 | - public function edit($id) |
|
| 114 | - {
|
|
| 105 | + } |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * Show the form for editing the specified resource. |
|
| 109 | + * |
|
| 110 | + * @param int $id |
|
| 111 | + * @return Response |
|
| 112 | + */ |
|
| 113 | + public function edit($id) |
|
| 114 | + {
|
|
| 115 | 115 | $result = EpormasCity::find($id); |
| 116 | 116 | return response()->json([ |
| 117 | 117 | 'result' => $result |
| 118 | 118 | ]); |
| 119 | - } |
|
| 120 | - |
|
| 121 | - /** |
|
| 122 | - * Update the specified resource in storage. |
|
| 123 | - * |
|
| 124 | - * @param int $id |
|
| 125 | - * @return Response |
|
| 126 | - */ |
|
| 127 | - public function update(Request $request, $version='', $id) |
|
| 128 | - {
|
|
| 119 | + } |
|
| 120 | + |
|
| 121 | + /** |
|
| 122 | + * Update the specified resource in storage. |
|
| 123 | + * |
|
| 124 | + * @param int $id |
|
| 125 | + * @return Response |
|
| 126 | + */ |
|
| 127 | + public function update(Request $request, $version='', $id) |
|
| 128 | + {
|
|
| 129 | 129 | $result = EpormasCity::find($id); |
| 130 | 130 | |
| 131 | 131 | $rules = [ |
@@ -134,24 +134,24 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | $validator = Validator::make($request->all(), $rules); |
| 136 | 136 | if ($validator->fails()) {
|
| 137 | - return response()->json([ |
|
| 138 | - 'title' => 'Error', |
|
| 139 | - 'type' => 'error', |
|
| 140 | - 'message' => $validator->errors()->all() |
|
| 141 | - ]); |
|
| 137 | + return response()->json([ |
|
| 138 | + 'title' => 'Error', |
|
| 139 | + 'type' => 'error', |
|
| 140 | + 'message' => $validator->errors()->all() |
|
| 141 | + ]); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | if($request->name != $result->name){
|
| 145 | - $data = EpormasCity::whereNull('deleted_at')
|
|
| 146 | - ->where('name', $request->name)
|
|
| 147 | - ->count(); |
|
| 148 | - if($data > 0){
|
|
| 145 | + $data = EpormasCity::whereNull('deleted_at')
|
|
| 146 | + ->where('name', $request->name)
|
|
| 147 | + ->count(); |
|
| 148 | + if($data > 0){
|
|
| 149 | 149 | return response()->json([ |
| 150 | 150 | 'title' => 'Error', |
| 151 | 151 | 'type' => 'error', |
| 152 | 152 | 'message' => 'Data has already been taken.' |
| 153 | 153 | ]); |
| 154 | - } |
|
| 154 | + } |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $path = \Request::path(); |
@@ -159,12 +159,12 @@ discard block |
||
| 159 | 159 | |
| 160 | 160 | $from = 'form'; |
| 161 | 161 | if(in_array('api',$explode)){
|
| 162 | - $from = 'api'; |
|
| 162 | + $from = 'api'; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $via = $from; |
| 166 | 166 | if($version != '' && $version != 'update'){
|
| 167 | - $via .= '-'.$version; |
|
| 167 | + $via .= '-'.$version; |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | $result->update([ |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | 'type' => 'success', |
| 177 | 177 | 'message' => 'Data updated successfully' |
| 178 | 178 | ]); |
| 179 | - } |
|
| 180 | - |
|
| 181 | - /** |
|
| 182 | - * Remove the specified resource from storage. |
|
| 183 | - * |
|
| 184 | - * @param int $id |
|
| 185 | - * @return Response |
|
| 186 | - */ |
|
| 187 | - public function destroy($id) |
|
| 188 | - {
|
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + /** |
|
| 182 | + * Remove the specified resource from storage. |
|
| 183 | + * |
|
| 184 | + * @param int $id |
|
| 185 | + * @return Response |
|
| 186 | + */ |
|
| 187 | + public function destroy($id) |
|
| 188 | + {
|
|
| 189 | 189 | EpormasCity::find($id)->delete(); |
| 190 | 190 | return response()->json([ |
| 191 | 191 | 'message' => 'Data deleted successfully' |
| 192 | 192 | ]); |
| 193 | - } |
|
| 193 | + } |
|
| 194 | 194 | |
| 195 | 195 | } |
| 196 | 196 | |
@@ -40,18 +40,18 @@ discard block |
||
| 40 | 40 | * |
| 41 | 41 | * @return Response |
| 42 | 42 | */ |
| 43 | - public function store(Request $request, $version='') |
|
| 43 | + public function store(Request $request, $version = '') |
|
| 44 | 44 | {
|
| 45 | 45 | $path = \Request::path(); |
| 46 | 46 | $explode = explode('/', $path);
|
| 47 | 47 | |
| 48 | 48 | $from = 'form'; |
| 49 | - if(in_array('api',$explode)){
|
|
| 49 | + if (in_array('api', $explode)) {
|
|
| 50 | 50 | $from = 'api'; |
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $via = $from; |
| 54 | - if($version != '' && $version != 'store'){
|
|
| 54 | + if ($version != '' && $version != 'store') {
|
|
| 55 | 55 | $via .= '-'.$version; |
| 56 | 56 | } |
| 57 | 57 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $data = EpormasCity::whereNull('deleted_at')
|
| 72 | 72 | ->where('name', $request->name)
|
| 73 | 73 | ->count(); |
| 74 | - if($data > 0){
|
|
| 74 | + if ($data > 0) {
|
|
| 75 | 75 | return response()->json([ |
| 76 | 76 | 'title' => 'Error', |
| 77 | 77 | 'type' => 'error', |
@@ -96,7 +96,7 @@ discard block |
||
| 96 | 96 | * @param int $id |
| 97 | 97 | * @return Response |
| 98 | 98 | */ |
| 99 | - public function show($version='', $id) |
|
| 99 | + public function show($version = '', $id) |
|
| 100 | 100 | {
|
| 101 | 101 | $result = EpormasCity::find($id); |
| 102 | 102 | return response()->json([ |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @param int $id |
| 125 | 125 | * @return Response |
| 126 | 126 | */ |
| 127 | - public function update(Request $request, $version='', $id) |
|
| 127 | + public function update(Request $request, $version = '', $id) |
|
| 128 | 128 | {
|
| 129 | 129 | $result = EpormasCity::find($id); |
| 130 | 130 | |
@@ -141,11 +141,11 @@ discard block |
||
| 141 | 141 | ]); |
| 142 | 142 | } |
| 143 | 143 | |
| 144 | - if($request->name != $result->name){
|
|
| 144 | + if ($request->name != $result->name) {
|
|
| 145 | 145 | $data = EpormasCity::whereNull('deleted_at')
|
| 146 | 146 | ->where('name', $request->name)
|
| 147 | 147 | ->count(); |
| 148 | - if($data > 0){
|
|
| 148 | + if ($data > 0) {
|
|
| 149 | 149 | return response()->json([ |
| 150 | 150 | 'title' => 'Error', |
| 151 | 151 | 'type' => 'error', |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | $explode = explode('/', $path);
|
| 159 | 159 | |
| 160 | 160 | $from = 'form'; |
| 161 | - if(in_array('api',$explode)){
|
|
| 161 | + if (in_array('api', $explode)) {
|
|
| 162 | 162 | $from = 'api'; |
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | $via = $from; |
| 166 | - if($version != '' && $version != 'update'){
|
|
| 166 | + if ($version != '' && $version != 'update') {
|
|
| 167 | 167 | $via .= '-'.$version; |
| 168 | 168 | } |
| 169 | 169 | |
@@ -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'; |
@@ -6,25 +6,25 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateEpormasCounterTable extends Migration { |
| 8 | 8 | |
| 9 | - public function up() |
|
| 10 | - { |
|
| 11 | - Schema::create('epormas_counter', function(Blueprint $table) { |
|
| 12 | - $table->increments('id'); |
|
| 13 | - $table->timestamps(); |
|
| 14 | - $table->softDeletes(); |
|
| 15 | - $table->integer('tahun')->unsigned()->index(); |
|
| 16 | - $table->string('bulan', 2)->index(); |
|
| 17 | - $table->datetime('tanggal')->index(); |
|
| 18 | - $table->integer('count')->unsigned()->index(); |
|
| 19 | - $table->string('via')->index(); |
|
| 20 | - $table->integer('user_id')->unsigned()->index(); |
|
| 21 | - $table->integer('category_id')->unsigned()->index(); |
|
| 22 | - $table->integer('city_id')->unsigned()->index(); |
|
| 23 | - }); |
|
| 24 | - } |
|
| 9 | + public function up() |
|
| 10 | + { |
|
| 11 | + Schema::create('epormas_counter', function(Blueprint $table) { |
|
| 12 | + $table->increments('id'); |
|
| 13 | + $table->timestamps(); |
|
| 14 | + $table->softDeletes(); |
|
| 15 | + $table->integer('tahun')->unsigned()->index(); |
|
| 16 | + $table->string('bulan', 2)->index(); |
|
| 17 | + $table->datetime('tanggal')->index(); |
|
| 18 | + $table->integer('count')->unsigned()->index(); |
|
| 19 | + $table->string('via')->index(); |
|
| 20 | + $table->integer('user_id')->unsigned()->index(); |
|
| 21 | + $table->integer('category_id')->unsigned()->index(); |
|
| 22 | + $table->integer('city_id')->unsigned()->index(); |
|
| 23 | + }); |
|
| 24 | + } |
|
| 25 | 25 | |
| 26 | - public function down() |
|
| 27 | - { |
|
| 28 | - Schema::dropIfExists('epormas_counter'); |
|
| 29 | - } |
|
| 26 | + public function down() |
|
| 27 | + { |
|
| 28 | + Schema::dropIfExists('epormas_counter'); |
|
| 29 | + } |
|
| 30 | 30 | } |
@@ -6,18 +6,18 @@ |
||
| 6 | 6 | |
| 7 | 7 | class CreateEpormasCityTable extends Migration { |
| 8 | 8 | |
| 9 | - public function up() |
|
| 10 | - { |
|
| 11 | - Schema::create('epormas_city', function(Blueprint $table) { |
|
| 12 | - $table->increments('id'); |
|
| 13 | - $table->timestamps(); |
|
| 14 | - $table->softDeletes(); |
|
| 15 | - $table->string('name', 191)->index(); |
|
| 16 | - }); |
|
| 17 | - } |
|
| 9 | + public function up() |
|
| 10 | + { |
|
| 11 | + Schema::create('epormas_city', function(Blueprint $table) { |
|
| 12 | + $table->increments('id'); |
|
| 13 | + $table->timestamps(); |
|
| 14 | + $table->softDeletes(); |
|
| 15 | + $table->string('name', 191)->index(); |
|
| 16 | + }); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | - public function down() |
|
| 20 | - { |
|
| 21 | - Schema::dropIfExists('epormas_city'); |
|
| 22 | - } |
|
| 19 | + public function down() |
|
| 20 | + { |
|
| 21 | + Schema::dropIfExists('epormas_city'); |
|
| 22 | + } |
|
| 23 | 23 | } |