コード例 #1
0
 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update($id, UserUpdateRequest $request)
 {
     $user = \App\user::find($id);
     $user->fill($request->all());
     $user->save();
     Session::flash('message', 'Usuario editado correctamente');
     return Redirect::to('/usuario');
 }
コード例 #2
0
ファイル: articleController.php プロジェクト: bcawosxy/mars
 public function index()
 {
     $user = Auth::user();
     if (!empty($user)) {
         echo $user->name;
     }
     /**
      * 9/14 現在是透過再次find(`user`)取得user資料,要找其他方式做Join關聯查詢 
      * 9/21 觀看全部文章,僅可編輯自己文章
      */
     $m_article = article::all();
     $articles = array();
     foreach ($m_article as $k => $v) {
         $articles[$k]['id'] = $v->id;
         $articles[$k]['name'] = $v->name;
         $articles[$k]['content'] = $v->content;
         $articles[$k]['updated_at'] = $v->updated_at;
         $articles[$k]['user_id'] = $v->user_id;
         $articles[$k]['user_mail'] = user::find($v->user_id)['account'];
     }
     return view('Mars.article.index')->withArticles($articles)->withTitle(self::$title)->withFun(self::$fun)->withUser($user);
 }
コード例 #3
0
ファイル: user.php プロジェクト: sandakinhs/iCRM3
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     session_start();
     $loguser = $_SESSION['user_id'];
     $data = ['modified_by' => $loguser, 'deleted' => '1'];
     App\user::find($id)->update($data);
 }
コード例 #4
0
 /**
  *
  * Get POST Requsets and Handle them
  * 
  * 
  * @return Json Response
  *
  */
 public function inputs()
 {
     $user = Session::get('user');
     if (Request::get('task') == "loadtableopendtickets") {
         $x = Request::get('skip');
         return $this->loadTableOpenedTickets($x);
     } elseif (Request::get('task') == "loadtableAvailabletickets") {
         $x = Request::get('skip');
         return $this->loadTableAvailableTickets($x);
     } elseif (Request::get('task') == "loadtableclosedtickets") {
         $x = Request::get('skip');
         return $this->loadTableClosedTickets($x);
     } elseif (Request::get('task') == "closeTicket") {
         $ids = Request::get('tickets');
         return $this->closeTickets($ids);
     } elseif (Request::get('task') == "openTicket") {
         $ids = Request::get('tickets');
         return $this->openTickets($ids);
     } elseif (Request::get('task') == "viewTicket") {
         $ids = Request::get('ticket');
         if (!is_null($ids)) {
             $ticketOwner;
             $ticket = tickets::find($ids);
             if (is_null($ticket)) {
                 abort(404);
             } else {
                 $ticketOwner = user::find($ticket->userid);
             }
             $ticketsMessages = tickets_messages::where('ticket_id', $ticket->id)->orderBy('id', 'asc')->get();
             return view('admin.reply')->with('user', $user)->with('messages', $ticketsMessages)->with('ticket', $ticket)->with('ticket_owner', $ticketOwner);
         } else {
             abort(404);
         }
     } elseif (Request::get('task') == "replyTickets") {
         $message = Request::get('text');
         $ticketId = Request::get('ticket_id');
         return $this->replyTickets($message, $ticketId);
     }
     return response()->json(['message' => 'Invalid Request', 'code' => 'error']);
     //return 1;
 }
コード例 #5
0
ファイル: test.php プロジェクト: friendkvvk/Gags-By-Mail
 function myplaceorder(Request $request)
 {
     if ($request['place'] == 1) {
         $order_address = new order_address();
         $order_address->type = "himself";
         $order_address->name = $request['name'];
         $order_address->phone = (string) $request['Contact Number'];
         $order_address->pincode = $request['postalcode'];
         $order_address->address = $request['address'];
         $order_address->message = $request['Personalized'];
         $order_address->order_id = $request['productid'];
         $order_address->save();
         $token = $request['productid'];
         $order_token = new product_token();
         $order_token->u_id = Session::get('uid');
         $order_token->order_id = $token;
         $return_key = md5($token . rand());
         $order_token->order_token = $return_key;
         $order_token->save();
         $api = new Instamojo('b0702bd721ad77f700aa98e4b5a8832a', 'aec9d4a72e40263ea010f35beae47f96');
         try {
             $response = $api->linkCreate(array('title' => 'Gags By Mail', 'description' => 'Create a new Link easily', 'base_price' => Session::get('price', 0), 'currency' => 'INR', 'redirect_url' => 'http://.' . $_SERVER['HTTP_HOST'] . './sucess/' . $return_key));
             $user = user::find(Session::get('uid'));
             //dd($user);
             return redirect($response['url'] . "?data_name=" . $user->name . "&data_email=" . $user->email . "&data_readonly=data_name&data_readonly=data_email");
         } catch (Exception $e) {
             print 'Error: ' . $e->getMessage();
         }
     } elseif ($request['place'] == 2) {
         $victimorder = new order_address();
         $victimorder->type = "victim";
         $victimorder->name = $request['name1'];
         $victimorder->address = $request['address1'];
         $victimorder->city = $request['city1'];
         $victimorder->pincode = $request['pincode1'];
         $victimorder->phone = $request['po1'];
         $victimorder->message = $request['message1'];
         $victimorder->order_id = $request['productid'];
         $victimorder->save();
         $token = $request['productid'];
         $order_token = new product_token();
         $order_token->u_id = Session::get('uid');
         $order_token->order_id = $token;
         $return_key = md5($token . rand());
         $order_token->order_token = $return_key;
         $order_token->save();
         $api = new Instamojo('b0702bd721ad77f700aa98e4b5a8832a', 'aec9d4a72e40263ea010f35beae47f96');
         try {
             $response = $api->linkCreate(array('title' => 'Gags By Mail', 'description' => 'Create a new Link easily', 'base_price' => Session::get('price', 0), 'currency' => 'INR', 'redirect_url' => 'http://' . $_SERVER['HTTP_HOST'] . '/sucess/' . $return_key));
             $user = user::find(Session::get('uid'));
             //dd($user);
             return redirect($response['url'] . "?data_name=" . $user->name . "&data_email=" . $user->email . "&data_readonly=data_name&data_readonly=data_email");
         } catch (Exception $e) {
             print 'Error: ' . $e->getMessage();
         }
     } else {
         echo "f**k u mother f****r";
     }
     /*
     
       $api = new Instamojo('b0702bd721ad77f700aa98e4b5a8832a', 'aec9d4a72e40263ea010f35beae47f96');
             try {
           $response = $api->linkCreate(array(
               'title'=>'Gags By Mail',
               'description'=>'Create a new Link easily',
               'base_price'=>Session::get('price',0),
               'currency'=>'INR',
               'redirect_url'=>'http://localhost:8000/sucess/'.$return_key
               ));
         $user=user::find(Session::get('uid'));
         //dd($user);
     
           return redirect($response['url']."?data_name=".$user->name."&data_email=".$user->email."&data_readonly=data_name&data_readonly=data_email");
       }
       catch (Exception $e) {
           print('Error: ' . $e->getMessage());
       }*/
 }
コード例 #6
0
 /**
  * BlockControl.
  *
  * Block or unblock the user out off the system.
  * Preventing them to login into the system.
  *
  * @param int $status, The status code. 1 = Block | 0 = Unblock.
  * @param int $id      ,     The id off the user.
  */
 public function blockControl($status, $id)
 {
     if (!Auth::user()->is('admin') || Auth::user()->is('developer') || Auth::user()->is('moderator')) {
         return Redirect::route('trips.index', ['selector' => 'all']);
     }
     $user = user::find($id);
     $user->status = $status;
     $user->save();
     $sessionQuery = Sessions::where('user_id', $id)->get();
     if (count($sessionQuery) == 1 && $status == 1) {
         Sessions::where('user_id', $id)->delete();
     }
     // Set flash message data.
     // Displayed when u block a user
     if ($status == 0) {
         // unblock
         $message = 'U hebt een gebruiker terug geactiveerd';
     } elseif ($status == 1) {
         // block
         $message = 'U hebt een gebruiker geblokkeerd';
     } else {
         // unknown
         $message = 'wij konden niet uitmaken welke handeling u wou uitvoeren.';
     }
     session()->flash('flash_title', 'Success!');
     session()->flash('flash_message', $message);
     session()->flash('flash_message_important', '');
     return Redirect::back();
 }
コード例 #7
0
 /**
  *
  * Change the role of the users
  * @param Stringlist $id user ids
  * @param String $role the role
  * @return Json Response
  *
  */
 private function changeRole($ids, $role)
 {
     $level = 1;
     if ($role == "User") {
         $level = 1;
     } elseif ($role == "Doctor") {
         $level = 2;
     } elseif ($role == "Admin") {
         $level = 10;
     } elseif ($role == "Moderator") {
         $level = 5;
     }
     if (!is_null($ids)) {
         foreach ($ids as &$value) {
             $user = user::find($value);
             $user->level = $level;
             $user->save();
         }
     } else {
         return response()->json(['message' => 'hacker', 'code' => 'error']);
     }
     return response()->json(['code' => 'success', 'task' => 'changeRole']);
 }
コード例 #8
0
 public function editprofile_user()
 {
     $id = \Auth::id();
     $currentuser = user::find($id);
     return view('user.edit_profile')->with('result', $currentuser);
 }