示例#1
0
 public function store($request)
 {
     $user = User::create(['first_name' => $request['first_name'], 'last_name' => $request['last_name'], 'email' => $request['email'], 'password' => bcrypt($request['password']), 'userCategory' => 5, 'hash_id' => str_random(100), 'verified' => 0]);
     $user->prof_pic()->create([]);
     $this->mailer->sendConfirmEmailLink($user);
     return $user;
 }
示例#2
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     \Md\User::truncate();
     DB::table('users')->insert(['first_name' => 'mother', 'last_name' => 'bongo', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'more_details' => 'I am an the mother admin', 'userCategory' => 4, 'verified' => 1, 'hash_id' => str_random(100)]);
     DB::table('users')->insert(['first_name' => 'Expert', 'last_name' => 'Expert', 'email' => '*****@*****.**', 'bongo_request_id' => '1', 'more_details' => 'I am an Expert in my field', 'password' => bcrypt('123456'), 'userCategory' => 3, 'verified' => 1, 'hash_id' => str_random(100)]);
     DB::table('users')->insert(['first_name' => 'Investor', 'last_name' => 'Investor', 'email' => '*****@*****.**', 'investor_request_id' => '1', 'more_details' => 'I am an Investor', 'investor_finance' => 1, 'investor_amount' => 1000000, 'password' => bcrypt('123456'), 'userCategory' => 2, 'verified' => 1, 'hash_id' => str_random(100)]);
     DB::table('users')->insert(['first_name' => 'Innovator', 'last_name' => 'Innovator', 'more_details' => 'I am an Innovator', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'userCategory' => 1, 'verified' => 1, 'hash_id' => str_random(100)]);
     DB::table('users')->insert(['first_name' => 'Moderator', 'last_name' => 'Moderator', 'email' => '*****@*****.**', 'password' => bcrypt('123456'), 'userCategory' => 5, 'verified' => 1, 'moderation_count' => 0, 'hash_id' => str_random(100)]);
 }
示例#3
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;
             }
         }
     }
 }
示例#4
0
 /**
  * Updates passwords
  * @param ChangePasswordRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function changePassword(ChangePasswordRequest $request)
 {
     $user = User::find(\Auth::user()->id);
     $old_password = $request->old_password;
     $password = $request->password;
     if (Hash::check($old_password, $user->password)) {
         $user->password = Hash::make($password);
         if ($user->save()) {
             Session::flash('flash_message', 'Password was successfully changed');
             return redirect()->back();
         }
     } else {
         Session::flash('flash_message_error', 'Password was not changed, try again');
         return redirect()->back();
     }
 }
示例#5
0
 /**
  * Retrieves all of a specific user's innovations
  *
  * @param User $user
  * @return mixed
  */
 public function innovationsForUser(User $user)
 {
     return $innovations = $user->innovation()->where('fundingStatus', '=', 0)->with('category', 'thread')->latest()->paginate(9, ['*'], 'innovations');
 }
 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array  $data
  * @return User
  */
 public function create(array $data)
 {
     return User::create(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]);
 }
示例#7
0
 public function confirmEmail($token)
 {
     User::whereToken($token)->firstOrFail()->confirmEmail();
     Session::flash('flash_message', 'Account was successfully confirmed, you can now login & publish your innovations!');
     return redirect('auth/login');
 }
示例#8
0
 public function updateProfileMother($profile_id, $request)
 {
     $user = User::findOrFail($profile_id);
     $user->update(['first_name' => $request->first_name, 'last_name' => $request->last_name, 'email' => $request->email]);
 }
示例#9
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'));
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     User::create(['first_name' => 'Chris', 'last_name' => 'Gmyr', 'email' => '*****@*****.**', 'password' => Hash::make('pass123')]);
     User::create(['first_name' => 'Taylor', 'last_name' => 'Otwell', 'email' => '*****@*****.**', 'password' => Hash::make('pass123')]);
 }
 /**
  * Creates a new message thread
  *
  * @return mixed
  */
 public function create()
 {
     $users = User::where('id', '!=', Auth::id())->get();
     return view('messenger.create', compact('users'));
 }
示例#12
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'));
 }