/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next) { $player = Player::find($request->id); if (Auth::guest() || $player->account != Auth::user()->guid) { return response()->view('errors.404'); } return $next($request); }
/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @param string|null $guard * @return mixed */ public function handle($request, Closure $next) { $player = Player::find($request->id); if ($player->private != 1 || Auth::check() && $player->account == Auth::user()->guid) { return $next($request); } return response()->view('errors.404'); }
/** * Update player's option * POST * * @param Request $request * @param int $id * @param string $name * @return Response */ public function ManageCharacter(Request $request, $id, $name) { $player = PlayerManager::find($id); $player->private = $request->has('private') ? 0 : 1; $player->background = $request->background; $player->presentation = $request->presentation; $player->save(); return redirect()->route('pages.character', [$player->guid, str_slug($player->name)]); }