Exemplo n.º 1
0
 public static function findDivisionLeaders($gid)
 {
     $conditions = array('position_id @' => array(1, 2), 'game_id' => $gid);
     $params = arrayToObject(Flight::aod()->from(Member::$table)->sortAsc('position_id')->sortDesc('rank_id')->where($conditions)->select()->many());
     foreach ($params as $member) {
         $position = Position::find($member->position_id);
         $member->position_desc = $position->desc;
     }
     return $params;
 }
 /**
  * Remove the specified resource from storage.
  * DELETE /position/{id}
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     $position = Position::find($id)->delete();
     if (is_null($position)) {
         $class = 'error';
         $message = 'Record does not exist.';
     } else {
         $class = 'success';
         $message = 'Record successfully deleted.';
     }
     return Redirect::route('designated-position.index')->with('class', $class)->with('message', $message);
 }
Exemplo n.º 3
0
 /**
  * Show the form for editing the specified position.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $position = Position::find(Crypt::decrypt($id));
     return View::make('positions.edit', ['position' => $position])->withTitle("Ubah {$position->name}");
 }
Exemplo n.º 4
0
 public function getRemove($id = false)
 {
     if (!$id) {
         return App::abort(404);
     }
     $item = Position::find($id);
     if (!$item) {
         return App::abort(404);
     }
     $item->delete();
     return Redirect::to("/structure/positions")->with("message", "Должность удалена.");
 }
Exemplo n.º 5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     // delete
     //        $aa = Monk::Where('position','=',3)->get();
     //        var_dump(count($aa));
     //        var_dump(count(Monk::Where('position','=',$id)->get()));
     if (count(Monk::Where('position', '=', $id)->get()) > 0) {
         Session::flash('message', 'Không thể xóa vì có Tăng Ni thuộc Position này!');
         return Redirect::to('positions');
     } else {
         $monk = Position::find($id);
         $monk->delete();
         Logfile::addData('Xóa', 'Ngiệp sư', $monk->id, $monk->name);
         Session::flash('message', 'positions da  bị xóa!');
         return Redirect::to('positions');
     }
 }