public function account()
 {
     if (Auth::User()) {
         $user_data = Auth::User();
     }
     $requests = array();
     $user = new user();
     $image = new image();
     $feature_img = $image->get_feature_image();
     $friend = new friend();
     $friend_request = $friend->show_friend_request();
     if (is_array($friend_request) && count($friend_request) >= 1) {
         foreach ($friend_request as $request) {
             $requests[] = $user->get_user($request->user_id);
         }
     }
     $get_friends = $friend->get_friends();
     foreach ($get_friends as $get_all_friend) {
         $all_friends[] = $user->get_user($get_all_friend->friend_id);
     }
     if (isset($all_friends) && count($all_friends) != 0) {
         return view('account')->with(array('image' => $feature_img, 'requests' => $requests, 'user_data' => $user_data, 'all_friends' => $all_friends));
     } else {
         return view('account')->with(array('image' => $feature_img, 'requests' => $requests, 'user_data' => $user_data));
     }
 }
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     //
     $user = new user();
     $participant = new participant();
     $Temprole = Request::get('role');
     if (strcmp($Temprole, "Membership") == 0) {
         $role = 0;
     } else {
         if (strcmp($Temprole, "Non Membership") == 0) {
             $role = 0;
         }
     }
     $password = Request::get('nim');
     //echo "password ".$password;
     //buat user
     $user->username = Request::get('nim');
     $user->role = $role;
     $user->password = Request::get('nim');
     $user->password = bcrypt($password);
     $user->save();
     //echo $user->password;
     //buat participant
     $participant->nim = Request::get('nim');
     $participant->name = Request::get('username');
     $participant->class = Request::get('class');
     $participant->major = Request::get('major');
     $participant->faculty = Request::get('fakultas');
     $participant->level = Request::get('level');
     $participant->membership_type = Request::get('role');
     $participant->save();
     //return  $user;
     return redirect('home')->with('message', 'berhasil register');
 }
Example #3
0
 public function save(UserRequest $request, user $user)
 {
     $userInput = $request->all();
     if (isset($userInput['password'])) {
         $userInput['password'] = bcrypt($userInput['password']);
     }
     $user->update($userInput);
     return $this->respond($user);
 }
 public function saveUser(Request $request)
 {
     $this->validate($request, ['name' => 'required', 'email' => 'required|email', 'password' => 'required|confirmed', 'password_confirmation' => 'required']);
     $parameters = $request->except(['password_confirmation', '_token']);
     $u = new user();
     $u->name = $parameters['name'];
     $u->email = $parameters['email'];
     $u->password = Hash::make($parameters['password']);
     $u->save();
     return redirect('/login')->with(['message' => trans('app.login'), 'alert' => 'warning']);
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     $authID = \Auth::user()->id;
     $stories = story::where('user_id', $id)->get();
     $profile = user::where('id', $id)->get();
     $thisProfiel = user::where('id', $id)->get()->first();
     // explore trip I made
     $explore = Expedition::where('user_id', $id)->get();
     // explore trips where I'm invite too
     $invexplore = Expfriend::select('expedition_id')->where('user_id', $id)->get();
     $invexplore = $invexplore->lists('expedition_id');
     $invexploration = Expedition::whereIn('id', $invexplore)->get();
     //my friends
     $listfriends = friend::select('friend_id')->where('user_id', $id)->where('state', 1)->get();
     $listfriends = $listfriends->lists('friend_id');
     $friends = user::whereIn('id', $listfriends)->get();
     //my invited for friends
     $notmyfriends = friend::select('user_id')->where('friend_id', $id)->where('state', 0)->get();
     $notmyfriends = $notmyfriends->lists('user_id');
     $invitefriends = user::whereIn('id', $notmyfriends)->get();
     if ($id == $authID) {
         $isthisme = "yes";
     } else {
         $isthisme = "no";
     }
     return view('profile.index', compact('stories', 'isthisme', 'friends', 'invitefriends', 'thisProfiel', 'explore', 'invexploration'));
 }
Example #6
0
 public function borrow2()
 {
     //$user = user::where('email', '=', Input::get('bemail'))->firstOrFail();
     $returnData = "";
     $name = Input::get("name");
     $email = Input::get("email");
     if (Request::ajax()) {
         $userCount = User::where('email', '=', Input::get('email'))->count();
         $bookCount = Book::where('barcode', '=', Input::get('barcode'))->count();
         if ($userCount == 1) {
             $returnData = $returnData . " user existed ";
             $user = User::where('email', '=', Input::get('email'))->find(1);
         }
         if ($userCount == 0) {
             $name = Input::get("name");
             $email = Input::get("email");
             $user = user::create(array('email' => $email, 'name' => $name));
             $returnData = $returnData . " user is created ";
         }
         if ($bookCount == 1) {
             $returnData = $returnData . " book existed ";
             $book = Book::where('barcode', '=', Input::get('barcode'))->find(1);
         }
         if ($bookCount == 0) {
             $title = Input::get('title');
             $author = Input::get('author');
             $barcode = Input::get('barcode');
             $book = book::create(array('title' => $title, 'author' => $author, 'barcode' => $barcode));
             $returnData = $returnData . " book is created ";
         }
         $borrow = Borrow::create(array('user_id' => $user->id, 'book_id' => $book->id));
         $returnData = $returnData . " borrowing is successful user id =" . $user->id . " book id =" . $book->id;
     }
     return $returnData;
 }
Example #7
0
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function view()
 {
     $rsExpenseList = expense::orderBy("expense.id", "DESC")->get();
     $arrExpenseList = array();
     foreach ($rsExpenseList as $expense) {
         $users = DB::table('users')->join('mapuserexpense', 'mapuserexpense.user_id', '=', 'users.id')->select('users.name')->where('mapuserexpense.expense_id', '=', $expense->id)->get();
         $expense['shared_by'] = $users;
         $expense['payed_by'] = user::find($expense->payed_by)->name;
         $arrExpenseList[] = $expense;
     }
     return view('user/manageExpense', ['arrExpenseList' => $arrExpenseList, "strCurrentPage" => "manage_expense"]);
 }
Example #8
0
 /**
  * @param $confirmationCode
  * @return mixed
  * @throws InvalidConfirmationCodeException
  * @internal param $confirmation_code
  */
 public function confirm($confirmationCode)
 {
     if (!$confirmationCode) {
         throw new InvalidConfirmationCodeException();
     }
     $user = user::where('confirmation_code', 'LIKE', $confirmationCode)->first();
     if (!$user) {
         dd($user);
     }
     $user->confirmed = 1;
     $user->confirmation_code = null;
     $user->save();
     //Flash::message('You have successfully verified your account.');
     return Redirect::route('login');
 }
Example #9
0
 public function seeProfile($idUser = 37)
 {
     //        echo '<pre>';print_r(Auth::user());exit;
     $idUser = 37;
     if (user::find($idUser) != false) {
         DB::statement("SET lc_time_names = 'es_ES'");
         $dataUser = array('infoGeneral' => user::find($idUser), 'infoSocialin' => user::find($idUser)->socialin, 'infoExperience' => experienceModel::obtenerExperienciaPorUsuario($idUser), 'infoEducation' => educationModel::obtenerEstudiosPorUsuario($idUser), 'infoCourse' => courseModel::obtenerCursosPorUsuario($idUser));
         //            $doctor['infoLinkedin']['srcImage']=doctorModel::isImageHere($doctor['infoLinkedin']);
         //            $doctor['infoLinkedin']['currentExperiences']=$exp->getCurrentExperience($idUser);
         //            $doctor['infoLinkedin']['oldExperiences']=$exp->getOldExperience($idUser);
         //            echo '<pre>';print_r($dataUser);exit;
         return view('perfil.show', ['dataUser' => $dataUser]);
     } else {
         //si el usuario no existe
         return redirect()->route('home');
     }
     return view("perfil.show");
 }
Example #10
0
 public function allUser()
 {
     $user = user::all();
     $html = '<div class="form-group">
                 <div class="col-sm-11 col-xs-10">
                     <select name="dealer[]" class ="form-control validator">
                         <option value="" selected>Choose Option</option>';
     foreach ($user as $User) {
         $html .= '<option value="' . $User->id . '">' . $User->first_name . '</option>';
     }
     $html .= '</select>
                 </div>
                  <div class="col-xs-1 row">
                     <a  href="javascript:void(0);"  class="btn btn-default remwholesale text-danger">
                         <i class="fa fa-minus-circle"></i>
                     </a>
                  </div>
              </div>';
     echo $html;
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store(CreateFriend $request)
 {
     $input = $request->all();
     $authU = \Auth::user()->id;
     $friend_mail = $input['email'];
     $friend_id = user::where('email', $friend_mail)->pluck('id');
     $friend_list = friend::where('user_id', $authU)->where('friend_id', $friend_id)->pluck('id');
     if ($authU == $friend_id) {
         return "u cant invite yourself to friends";
     } elseif (!empty($friend_list)) {
         return "friend is already your friend";
     } elseif (empty($friend_id)) {
         return "Persone u looking for isn't on Urban Tell, invite him/her";
     } else {
         $friend = new friend();
         $friend->user_id = $authU;
         $friend->friend_id = $friend_id;
         $friend->state = 0;
         $friend->save();
         return redirect('profile/' . $authU);
     }
 }
 public function modAdd()
 {
     $film = Input::get('film');
     $user = Input::get('user');
     $review = Input::get('review');
     $vote = Input::get('vote');
     $check = DB::table('film_review')->where('fr_usr_id', $user)->where('fr_fl_id', $film)->first();
     if ($check) {
     } else {
         if (!$review == "") {
             // inserts the review
             $rev = new Review();
             // revie instance
             $rev->fr_fl_id = $film;
             $rev->fr_usr_id = $user;
             $rev->fr_review = $review;
             $rev->fr_vote = $vote;
             $rev->fr_date = \time();
             $rev->save();
             // saves review
             // insert a new user actions
             $act = new Activity();
             // notification instance
             $act->type_id = '2';
             // activity type 2 for review
             $act->subject_id = $user;
             // id of the user
             $act->object_type = 'film';
             // type of object
             $act->object_id = $film;
             // id of the object
             $act->action_date = \time();
             // time of the activity
             $act->save();
             // saves activity
         }
     }
     // gets the review details from the given id
     $latest = DB::table('film_review')->where('fr_usr_id', $user)->orderBy('fr_id', 'desc')->first();
     $user = user::find($user);
     return view('reviews.add', compact('latest', 'user'));
 }
Example #13
0
 public function edit($username)
 {
     $users = $this->user->whereUsername($username)->first();
     is_null($users) ? $users = user::create(['username' => $username]) : '';
     return view('users.edit', compact('users'));
 }
 public function showPatient($userId)
 {
     $patient = user::where('userId', $userId)->first();
     return view('nurse.recordPatientGeneralDetail2')->with('patient', $patient);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $editor = \Auth::user()->id;
     $author = Story::where('id', $id)->pluck('user_id');
     if ($author == $editor) {
         $state = 'on';
         $story = Story::find($id);
         $parts = part::where('story_id', $id)->get();
         $author = user::where('id', $editor)->get()->first();
         return view('story.edit', compact('story', 'state', 'parts', 'author'));
     } else {
         return redirect('story/' . $id);
     }
 }
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy(Request $request)
 {
     echo $request->id;
     user::destroy($request->id);
     return redirect()->action('Hello_controller@index');
 }
Example #17
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = user::all();
     return view('users', ['user' => $user]);
 }
Example #18
0
 public function search(Request $request)
 {
     $date_from = "";
     $date_to = "";
     $validator = Validator::make($request->all(), ['date_from' => 'required', 'date_to' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $arrUser = User::lists('name', 'id');
     $date_from = date("Y-m-d", strtotime($request->date_from)) . " 00:00:00";
     $date_to = date("Y-m-d", strtotime($request->date_to)) . " 23:59:59";
     //$arrExpenseList = expense::whereBetween('created_at',array($date_from,$date_to))->orderBy("expense.id", "ASC")->get();
     $arrExpenseList = expense::whereRaw('created_at between "' . $date_from . '" and "' . $date_to . '"')->get();
     $ExpenseList = array();
     $sumData = array();
     $sumTotalPay = array();
     foreach ($arrUser as $k => $user) {
         $sumData[$k] = 0;
         foreach ($arrUser as $i => $user) {
             $sumTotalPay[$k][$i] = 0;
         }
     }
     $total_expense = 0;
     if (count($arrExpenseList) > 0) {
         foreach ($arrExpenseList as $expense) {
             $share_count = $expense->shared_by_users->count();
             $countData = array();
             foreach ($arrUser as $k => $user) {
                 $count = DB::table('mapuserexpense')->where('expense_id', $expense->id)->where('user_id', $k)->count();
                 if ($count > 0) {
                     $cost = $expense->price / $share_count;
                     $countData[] = $cost;
                     $sumData[$k] = $sumData[$k] + $cost;
                     $total_expense += $cost;
                     $sumTotalPay[$expense->payed_by][$k] += $cost;
                 } else {
                     $countData[] = NULL;
                 }
             }
             $ExpenseList[] = array('expense_name' => $expense->expense_name, 'price' => $expense->price, 'payed_by' => user::find($expense->payed_by)->name, 'created_at' => $expense->created_at, 'countData' => $countData, 'sumData' => $sumData);
         }
     } else {
         $ExpenseList = array();
     }
     return view('user/reports', ["strCurrentPage" => "reports", "total_expense" => $total_expense, "arrUser" => $arrUser, "sumTotalPay" => $sumTotalPay, 'date_from' => $date_from, 'date_to' => $date_to, "arrExpenseList" => $ExpenseList]);
 }
Example #19
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy(Request $request)
 {
     foreach ($request->input('to_delete') as $item_id) {
         user::destroy($item_id);
     }
     Session::flash('message', 'user borrado Correctamente');
     return Redirect::to('backend//users');
 }
 public function postActive()
 {
     $obj = new user();
     $obj->where('remember_token', '=', Request::get('code'))->update(['status' => 'active']);
     return view('auth.login');
 }
Example #21
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $user = user::where('id', Auth::user()->id)->first();
     return view('welcome', compact('user'));
 }
 public function createInfo()
 {
     $logged_user_id = Auth::user()->id;
     $user = user::find($logged_user_id);
     return View::make('userInfoForm')->with('user', $user);
 }
 public function registration(Request $request)
 {
     $validator = Validator::make($request->all(), ['full_name' => 'required|max:50', 'user_name' => 'required|max:30|unique:users', 'email' => 'required|email|max:50|unique:users', 'password' => 'required|max:50', 'address' => 'required|max:50']);
     if ($validator->fails()) {
         $data['errors'] = $validator->errors()->first();
         return response()->json($data);
     }
     $user = user::create(['full_name' => $request->full_name, 'user_name' => $request->user_name, 'email' => $request->email, 'password' => bcrypt($request->password), 'address' => $request->address]);
     $data['success'] = $user;
     return response()->json($data);
 }
 public function viewStudent($id)
 {
     if (!$this->auth()) {
         return "You have no Permissions!";
     }
     $user = user::where('id', '=', $id)->get();
     $user = $user[0];
     $pref = student_preferences::where('id', '=', $id)->get();
     $classes = student_classes::where('id', '=', $id)->get(array('classID'));
     return view('studentInfo', compact('user', 'pref', 'classes'));
 }
Example #25
0
 /**
  * Show the form for creating a new resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function create()
 {
     $user = user::where('id', Auth::user()->id)->first();
     return view('game_room', compact('user'));
 }
Example #26
0
 public function destroy($id)
 {
     user::destroy($id);
     return redirect('/admin/users');
 }
 public function processphoto(Request $request)
 {
     $validator = Validator::make($request->all(), ['profile_photo' => 'required']);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator)->withInput();
     }
     $file = $request->file('profile_photo');
     $path = public_path('uploads/');
     $filename = str_random(24) . "." . $file->getClientOriginalExtension();
     $fileExtension = $file->getClientOriginalExtension();
     $fileSize = $file->getSize();
     if ($fileSize > 512000) {
         $request->session()->flash('message', 'Sorry file size large');
         return redirect('profile_photo');
     }
     if ($fileExtension != "jpg" && $fileExtension != "png") {
         $request->session()->flash('message', 'Sorry try jpg or png');
         return redirect('profile_photo');
     } else {
         if (!file_exists($filename)) {
             $file->move($path, $filename);
             try {
                 $user = user::find(Auth::user()->id);
                 $user->update(['profile_photo' => $filename]);
                 $request->session()->flash('message', 'Upload success');
                 return redirect('dashboard');
             } catch (QueryException $e) {
                 $request->session()->flash('message', $e->getMessage());
                 return redirect('dashboard');
             }
         } else {
             $filename = str_random(24) . "." . $file->getClientOriginalExtension();
             $file->move($path, $filename);
             try {
                 $user = user::find(Auth::user()->id);
                 $user->update(['profile_photo' => $filename]);
                 $request->session()->flash('message', 'Upload success');
                 return redirect('dashboard');
             } catch (QueryException $e) {
                 $request->session()->flash('message', $e->getMessage());
                 return redirect('dashboard');
             }
         }
     }
 }
Example #28
0
 public function hmm()
 {
     user::create(['email' => '*****@*****.**', 'password' => Hash::make('restu'), 'name' => 'restu']);
 }