예제 #1
0
 public function get_division_data()
 {
     \DB::statement(\DB::raw('set @rownum=0'));
     $divisions = OfficeDivision::select([\DB::raw('@rownum  := @rownum  + 1 AS rownum'), 'id', 'office_id', 'code', 'name', 'abbreviation', 'date_open']);
     return Datatables::of($divisions)->addColumn('action', function ($divisi) {
         return '
             <a href="./detail_depart/' . $divisi->id . '" class="btn btn-xs btn-info"><i class="glyphicon glyphicon-plus"></i> Bagian</a>
             <a href="./edit/' . $divisi->office_id . '/' . $divisi->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_division/' . $divisi->id . '">Delete</button>
             ';
     })->editColumn('date_open', function ($divisi) {
         return $divisi->date_open ? with(new Carbon($divisi->date_open))->format('d/m/Y') : '';
     })->make(true);
 }
예제 #2
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function edit($id)
 {
     $user = User::find($id);
     $roles = Role::lists('name', 'id');
     $office_region = Office::select(\DB::raw("CONCAT(offices.code,'-',offices.name) AS full_name, id"))->lists('full_name', 'id');
     $division_kprk = OfficeDivision::select(\DB::raw("CONCAT(code,'-',name) AS full_name, id"))->lists('full_name', 'id');
     return view('users.edit', compact('user', 'roles', 'office_region', 'division_kprk'));
 }