Advertisement
Guest User

Untitled

a guest
Nov 16th, 2018
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.67 KB | None | 0 0
  1.     public function toggleWinnerPublish($winner_id = null){
  2.  
  3.         if ($winner_id){
  4.             $winner = Winners::find($winner_id);
  5.             if ($winner){
  6.                 $redemption = Redemptions::find($winner->redemption_id);
  7.                 if ($redemption) {
  8.                     if ($winner->published) {
  9.                         $winner->published = 0;
  10.                     } else {
  11.                         $winner->published = 1;
  12.                     }
  13.                     $winner->save();
  14.                     HomeController::sendPublishMail($winner->id,$redemption->email);
  15.                 }
  16.             }
  17.         }
  18.         return redirect('/winners');
  19.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement