performer = get_current_session(); if($this->performer && $this->performer->pro) { $this->pro = $this->performer->pro; view()->share('pro', $this->performer->pro); } view()->share('performer', $this->performer); $this->pros = []; /*$this->pros = Pro::all(); if($this->pro && $this->pro->pro_type != 'ADMIN'){ $accessiblePros = ProProAccess::where('owner_pro_id', $this->pro->id); $accessibleProIds = []; foreach($accessiblePros as $accessiblePro){ $accessibleProIds[] = $accessiblePro->id; } $accessibleProIds[] = $this->pro->id; $this->pros = Pro::whereIn('id', $accessibleProIds)->get(); }*/ view()->share('pros',$this->pros); // view()->share('notes', Note::all()); // $noteTemplates = NoteTemplate::all(); // view()->share('noteTemplates', $noteTemplates); $initiatives = ['LHI', 'BHI']; view()->share('intiatives', $initiatives); $rmCodes = ['RMB','RM20', 'RM40','RM60']; view()->share('rmCodes', $rmCodes); } public function performer(){ $sessionKey = Cookie::get('sessionKey'); if ($sessionKey == null){ throw new \Exception('No session key in cookie.'); } $performer = AppSession::where('session_key', $sessionKey)->first(); return $performer; } public function getMyClientIds(){ if($this->pro == null){ return []; } return $this->pro->getMyClientIds(); } public function pass($data = null): array { return [ 'success' => true, 'data' => $data, ]; } public function fail($message): array { return [ 'success' => false, 'message' => $message ]; return null; } }