/** * Handle an incoming request. * * @param \Illuminate\Http\Request $request * @param \Closure $next * @return mixed */ public function handle($request, Closure $next) { if (UserProfile::perfilId($this->auth->user()->id) == Camp::perfilId(app()->router->getCurrentRoute()->getParameter('camp'))) { return $next($request); } else { if ($request->ajax()) { return response('Unauthorized.', 401); } else { return new RedirectResponse(url('/home')); } } }
static function getColor($id, $profileIdVisualitzador) { if (Camp::perfilId($id) == $profileIdVisualitzador) { return '#FF0000'; } else { if (Camp::esVisible($id, $profileIdVisualitzador)) { $color = '#00FF00'; } else { $color = '#000000'; } } return $color; }
public static function esVisible($id, $profileIdVisualitzador) { if (Camp::perfilId($id) == $profileIdVisualitzador) { return true; } else { switch (Camp::getVisibilitat($id)) { case 1: //Tots return true; break; case 2: //NingĂș return false; break; case 3: //Amics dd('no definit'); break; default: return false; break; } } }