Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!--INI FILE CONTROLLER FOR GMAP LARAVEL -->
- <?php
- namespace App\Http\Controllers;
- use Illuminate\Http\Request;
- use DB;
- class CustomPageController extends Controller
- {
- //
- public function peta(Request $req){
- $input = $req->all();
- if($input){
- $all_data = $this->loadAllData($input);
- }
- else{
- $all_data = $this->loadAllData(null);
- }
- $all_indikator = $this->getAllIndikator();
- $user = DB::table('cms_users')->select('id','name')->where('id_cms_privileges',3)->get();
- return view('custom.peta.index',compact('all_indikator','all_data','user'));
- }
- public function getAllIndikator(){
- // group per indikator
- $find_ind = DB::table('master_all_indikator')->select(DB::raw("distinct(indikator)"))->get();
- foreach ($find_ind as $key => $value) {
- $hasil[$value->indikator] = $this->getIndikator($value->indikator);
- }
- return $hasil;
- }
- public function getIndikator($indikator){
- return DB::table('master_all_indikator')->select('indikator','title','value','text')->where('indikator',$indikator)->orderBy('value')->get();
- }
- public function loadAllData($filtered = null){
- $data = DB::table('peoples as p')->select('*')->join('cms_users as u','u.id','=','p.user_id')->where('u.id_cms_privileges','3');
- if($filtered){
- foreach ($filtered as $key => $value) {
- if($value!==''){
- $data = $data->where($key,$value);
- }
- }
- }
- // total data
- // dd($data->count());
- return $data->get();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement