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(); }
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(); }