Ejemplo n.º 1
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']);
 }
Ejemplo n.º 2
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']);
 }