Example #1
0
 public function decline($bannerId)
 {
     $banner = Banner::findOrFail($bannerId);
     if ($banner->twitcher_id != $this->user->id) {
         return redirect('/user/twitcher');
     }
     if ($banner->is_active == 1 || $banner->status != 'waiting') {
         return redirect('/user/twitcher');
     }
     BannerMapper::declineBanner($banner);
     return Redirect::to('/user/twitcher')->with(['success' => 'You declined banner']);
 }
Example #2
0
 public function complainDeclineSave($streamId, $bannerId, Request $request)
 {
     $stream = Stream::findOrFail($streamId);
     $banner = Banner::findOrFail($bannerId);
     if ($stream->user_id != $this->user->id) {
         return Redirect::to('/user/twitcher/streams')->withErrors('You have no rights for this');
     }
     $pivot = StreamMapper::getPivot($banner, $stream);
     if ($pivot->status != 'declining') {
         return Redirect::to('/user/twitcher/stream/' . $stream->id)->withErrors('Stream is not declining');
     }
     $this->validate($request, ['comment' => 'required|min:5']);
     $comment = $request->get('comment');
     $pivot->status = 'complain';
     $pivot->twitcher_comment = $comment;
     $pivot->save();
     LogMapper::log('banner_complained', $banner->id, $stream->id);
     NotificationMapper::bannerPayComplained($banner, $stream, $pivot->amount);
     return Redirect::to('/user/twitcher/stream/' . $stream->id)->with(['success' => 'You complained about banner declined']);
 }
Example #3
0
 public function updateStatus($status, $id)
 {
     try {
         $dado = Banner::findOrFail($id);
         $dado->status = $status;
         $dado->save();
         session()->flash('flash_message', 'Status alterado com sucesso!');
     } catch (\Exception $e) {
         LogR::exception($dado, $e);
         session()->flash('flash_message', 'Ops!! Ocorreu algum problema!. ' . $e->getMessage());
     }
     return Redirect::back();
 }
Example #4
0
 public function declineSave($streamId, $bannerId, Request $request)
 {
     $stream = Stream::findOrFail($streamId);
     $banner = Banner::findOrFail($bannerId);
     if (!StreamMapper::checkOwner($this->user, $banner, $stream)) {
         return Redirect::to('/user/client/streams')->withErrors('You have no rights for this');
     }
     if ($stream->time_end == null) {
         return Redirect::to('/user/client/stream/' . $stream->id)->withErrors('Stream is still live');
     }
     $pivot = StreamMapper::getPivot($banner, $stream);
     if ($pivot->status != 'waiting') {
         return Redirect::to('/user/client/stream/' . $stream->id)->withErrors('Stream is not for paying');
     }
     $isFinished = $this->isStreamFinished($stream);
     if (!$isFinished) {
         return Redirect::to('/user/client/stream/' . $stream->id)->withErrors('Stream is still alive');
     }
     $this->validate($request, ['comment' => 'required|min:5']);
     $comment = $request->get('comment');
     $pivot->status = 'declining';
     $pivot->client_comment = $comment;
     $pivot->save();
     LogMapper::log('banner_declining', $banner->id, $stream->id);
     NotificationMapper::bannerPayDeclining($banner, $stream, $pivot->amount);
     return Redirect::to('/user/client/stream/' . $stream->id)->with(['success' => 'You declined to pay the banner in this stream']);
 }