예제 #1
0
 public function mendaftar($id)
 {
     $penawaran = Penawaran::findOrFail($id);
     $user = Pegawai::findOrFail(\Input::get('user_id'));
     $id_pegawai_terdaftar = $penawaran->pegawai()->getRelatedIds();
     if (in_array($user->id, $id_pegawai_terdaftar)) {
         return "already registered";
     }
     $penawaran->pegawai()->attach($user->id);
     return $penawaran->pegawai;
 }
예제 #2
0
 public function optionsValue()
 {
     $query = \Input::get('query');
     $items = Pegawai::where('name', 'like', '%' . $query . '%')->take(10)->get();
     return $items;
 }