Exemplo n.º 1
0
 public function getWinnersOfPreviousPeriods()
 {
     $winners = Winner::all();
     $data = collect();
     foreach ($winners as $winner) {
         $user = Winner::find($winner->id)->user->name;
         $period = Winner::find($winner->id)->keycode->period_id;
         $data->push(['name' => $user, 'period' => $period]);
     }
     return $data->toArray();
 }
Exemplo n.º 2
0
 public function winnerCash($winner_id)
 {
     $winner = Winner::find($winner_id);
     $winner->is_cash = 1;
     $winner->save();
     if ($winner->id) {
         flash()->success('操作成功');
     } else {
         flash()->error('操作失败');
     }
     return redirect()->back();
 }