コード例 #1
0
ファイル: UserController.php プロジェクト: thesaputra/xyz-prx
 public function getDivisiOrKprk(Request $request)
 {
     if ($request->input('type') == 'reg') {
         $office_region = RegionKPRK::select(\DB::raw("CONCAT(code,'-',name) AS full_name, id"))->where('region_id', '=', $request->input('id'))->lists('full_name', 'id');
     } else {
         $office_region = OfficeDivision::select(\DB::raw("CONCAT(code,'-',name) AS full_name, id"))->where('office_id', '=', $request->input('id'))->lists('full_name', 'id');
     }
     return Response::json($office_region);
 }
コード例 #2
0
 public function get_kprk_data($region_id)
 {
     \DB::statement(\DB::raw('set @rownum=0'));
     $kprks = RegionKPRK::select([\DB::raw('@rownum  := @rownum  + 1 AS rownum'), 'id', 'region_id', 'code', 'name', 'abbreviation', 'date_open'])->where('region_id', '=', $region_id);
     return Datatables::of($kprks)->addColumn('action', function ($kprk) {
         return '
           <a href="./detail_kpc/' . $kprk->id . '" class="btn btn-xs btn-info"><i class="glyphicon glyphicon-plus"></i> KPC</a>
           <a href="./edit/' . $kprk->region_id . '/' . $kprk->id . '" class="btn btn-xs btn-warning"><i class="glyphicon glyphicon-edit"></i> Edit</a>
           <button id="btn-delete" class="btn btn-xs btn-danger" data-remote="./destroy_kprk/' . $kprk->id . '">Delete</button>
           ';
     })->editColumn('date_open', function ($kprk) {
         return $kprk->date_open ? with(new Carbon($kprk->date_open))->format('d/m/Y') : '';
     })->make(true);
 }