Exemplo n.º 1
0
 public function load($innovator_id)
 {
     if (User::where('hash_id', '=', $innovator_id)->first() == null) {
         return null;
     } else {
         return User::where('hash_id', '=', $innovator_id)->with('investor_request', 'prof_pic')->first();
     }
 }
Exemplo n.º 2
0
 /**
  * Handles confirmation of the link
  * @param $request_link
  * @return int
  */
 public function confirm($request_link)
 {
     if (Bongo_request::where('request_link', '=', $request_link)->first() == null) {
         return 0;
     } elseif (Bongo_request::where('request_link', '=', $request_link)->first()->request_status != 1) {
         return 0;
     } else {
         $request = Bongo_request::where('request_link', '=', $request_link)->first();
         $created = new Carbon($request->created_at);
         $now = Carbon::now();
         $difference = $created->diff($now)->days > 7 ? $request->update(['request_status' => 2]) : $request->update(['request_status' => 1]);
         if ($request = Bongo_request::where('request_link', '=', $request_link)->first()) {
             if (\Md\User::where('email', '=', $request->bongo_email)->first() != null) {
                 return 1;
             } else {
                 return 2;
             }
         }
     }
 }
Exemplo n.º 3
0
 public function getModeratorWithLeast()
 {
     $leastModeration_count = User::where('userCategory', '=', 5)->min('moderation_count');
     return User::where('userCategory', '=', 5)->where('moderation_count', '=', $leastModeration_count)->first()->id;
 }
Exemplo n.º 4
0
 /**
  * Retrieves a specific innovation with its related data
  * @param $id
  * @param ConversationRepository $conversationRepository
  * @return \Illuminate\View\View
  */
 public function show($id, ConversationRepository $conversationRepository)
 {
     $innovation = $this->repo->retrieve($id);
     $check_chat = $conversationRepository->chatExists($id);
     $currentUserId = Auth::user()->id;
     $chatWithInnovator = $conversationRepository->checkChatWithInnovator($id);
     $mother = User::where('id', '=', $innovation->moderator_id)->first();
     $users = User::where('userCategory', '=', 3)->get();
     $investors = User::where('userCategory', '=', 2)->get();
     // All threads that user is participating in
     $threads = Thread::forUser($currentUserId)->where('innovation_id', '=', $id)->get();
     $threads_count = $threads->count();
     if (\Auth::user()->isInvestor()) {
         if (Thread::where('innovation_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->exists() == true) {
             $thread = Thread::where('innovation_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
         }
     }
     if (\Auth::user()->isMother()) {
         if (Thread::where('innovation_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->exists() == true) {
             $thread_mother = Thread::where('innovation_id', '=', $id)->where('user_id', '=', \Auth::user()->id)->first();
         } else {
             $thread_mother = null;
         }
     }
     $funds = $this->repo->getPortfolio($id);
     $totalNeeded = $this->repo->getInnovationFund($id);
     return view('innovation.show', compact('totalNeeded', 'funds', 'thread_mother', 'thread', 'investors', 'mother', 'users', 'chatWithInnovator', 'innovation', 'id', 'check_chat', 'message', 'threads', 'threads_count', 'currentUserId'));
 }
 /**
  * Creates a new message thread
  *
  * @return mixed
  */
 public function create()
 {
     $users = User::where('id', '!=', Auth::id())->get();
     return view('messenger.create', compact('users'));
 }
Exemplo n.º 6
0
 /**
  * Creates a conversation thread with mother
  * @param $innovation_id
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function createMother($innovation_id)
 {
     $users = User::where('id', '=', 1)->get();
     return view('messenger.with_subject', compact('users', 'innovation_id'));
 }