public function client($bannerStreamId) { $bannerStream = BannerStream::findOrFail($bannerStreamId); $banner = $bannerStream->banner; $stream = $bannerStream->stream; $client = $banner->client; StreamMapper::decline($banner, $stream); LogMapper::log('banner_declined', $banner->id, $stream->id); LogMapper::log('decline_resolve', $banner->id, $stream->id, ['resolution' => 'client wins']); NotificationMapper::bannerPayDeclined($banner, $stream, $bannerStream->amount); return redirect('/admin/decline')->with(['success' => 'You accepted client\'s point of view']); }
public function acceptDecline($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'); } StreamMapper::decline($banner, $stream); LogMapper::log('banner_declined', $banner->id, $stream->id); NotificationMapper::bannerPayDeclined($banner, $stream, $pivot->amount); return Redirect::to('/user/twitcher/stream/' . $stream->id)->with(['success' => 'Your stream was declined. We are sorry about this']); }