Esempio n. 1
0
 public function getNodeid()
 {
     $q = Input::get('term');
     $user = Position::where('group_id', 4)->where(function ($query) use($q) {
         $query->where('name', 'regexp', '/' . $q . '/i')->orWhere('node_code', 'regexp', '/' . $q . '/i');
     })->get();
     $result = array();
     foreach ($user->toArray() as $r) {
         $result[] = array('id' => $r['node_code'], 'value' => $r['node_code']);
     }
     return Response::json($result);
 }
 /**
  * function name : delete
  * edit data Position
  * get
  */
 public function delete($id)
 {
     if (Auth::check()) {
         $result = Position::where('position_id', $id)->delete();
         if ($result) {
             return Redirect::to('admin/positions')->with('success_message', 'ลบข้อมูลเรียบร้อยแล้ว');
         } else {
             return Redirect::to('admin/positions')->with('error_message', 'ไม่สามารถลบข้อมูลได้ กรุณาแจ้งผู้ดูแลระบบ');
         }
     } else {
         return View::make('users.index');
     }
 }
Esempio n. 3
0
 public static function getPosition($key = null, $val = null)
 {
     if (is_null($key)) {
         $c = Position::get();
         self::$position = $c;
         return new self();
     } else {
         $c = Position::where($key, '=', $val)->first();
         self::$position = $c;
         return $c;
     }
 }