Add delete (& save to ManualPayout) buttons added to Season index page
This commit is contained in:
parent
85868e5599
commit
3bdb32ae75
2 changed files with 36 additions and 9 deletions
|
|
@ -5,11 +5,12 @@ namespace App;
|
|||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Season;
|
||||
use App\User;
|
||||
use Log;
|
||||
|
||||
class ManualPayout extends Model
|
||||
{
|
||||
protected $fillable = [
|
||||
'season_id','quota_name','user_id'
|
||||
'season_id','name','user_id'
|
||||
];
|
||||
|
||||
public static function getManualQuotaNames() {
|
||||
|
|
@ -42,6 +43,8 @@ class ManualPayout extends Model
|
|||
|
||||
$season = Season::getCurrent();
|
||||
|
||||
Log::info("setWinner, season_id=".$season->id.", quota_name='".$quotaName."'");
|
||||
|
||||
$entry = ManualPayout::where('season_id','=',$season->id)->where('quota_name','=',$quotaName)->first();
|
||||
if (!$entry) {
|
||||
$entry = new ManualPayout;
|
||||
|
|
@ -49,6 +52,7 @@ class ManualPayout extends Model
|
|||
$entry->season_id = $season->id;
|
||||
$entry->quota_name = $quotaName;
|
||||
}
|
||||
|
||||
$entry->user_id = $userId;
|
||||
$entry->save();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue