/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $incident = Incident::find($id);
     $incident->lat = str_replace(',', '.', $incident->lat);
     $incident->lng = str_replace(',', '.', $incident->lng);
     return view('detail')->with('scan', $incident);
 }
Beispiel #2
0
 public function closeIncident($incidentId, Request $request)
 {
     $incident = Incident::find($incidentId);
     $incident->update(['status' => 'closed', 'closed_at' => date('Y-m-d h:i:s')]);
     Comment::create(['incident_id' => $incident->id, 'comment' => 'Cierre de incidente: ' . $request->input('comment'), 'user_id' => Auth::user()->id]);
     $request->session()->flash('alert-success', 'El incidente número <strong>' . $incident->id . '</strong> ha sido cerrado con éxito');
     return redirect('/dashboard');
 }
Beispiel #3
0
 /**
  * 冒险中的事件发生处理 完成度20%
  * @param $objBattle
  * @return mixed
  */
 public function happen($objBattle)
 {
     // 取得事件的Master内容
     $objIncident = Incident::find($this->incident_id);
     if (empty($objIncident->target_category) || !$objIncident->target_category) {
         return $objBattle;
     }
     // 根据事件类型进行不同处理
     switch ($objIncident->target_category) {
         case 'hp':
             if ($objIncident->type == 'good') {
                 $objBattle->buff_hp = $objBattle->buff_hp + $this->power;
             } else {
                 $objBattle->buff_hp = $objBattle->buff_hp - $this->power;
             }
             break;
         case 'atk':
             if ($this->type == 'good') {
                 $objBattle->buff_atk = $objBattle->buff_atk + $this->power;
             } else {
                 $objBattle->buff_atk = $objBattle->buff_atk - $this->power;
             }
             break;
         case 'def':
             if ($objIncident->type == 'good') {
                 $objBattle->buff_def = $objBattle->buff_def + $this->power;
             } else {
                 $objBattle->buff_def = $objBattle->buff_def - $this->power;
             }
             break;
         case 'spd':
             if ($objIncident->type == 'good') {
                 $objBattle->buff_spd = $objBattle->buff_spd + $this->power;
             } else {
                 $objBattle->buff_spd = $objBattle->buff_spd - $this->power;
             }
             break;
         case 'spd':
             if ($objIncident->type == 'good') {
                 $objBattle->buff_spd = $objBattle->buff_spd + $this->power;
             } else {
                 $objBattle->buff_spd = $objBattle->buff_spd - $this->power;
             }
             break;
         case 'card':
             break;
         case 'item':
             break;
         case 'money':
             $player = Player::find($objBattle->player_id);
             if ($objIncident->type == 'good') {
                 $player->appendMoney($this->power);
             } else {
                 $player->appendMoney(0 - $this->power);
             }
             break;
         default:
             # code...
             break;
     }
     return $objBattle;
 }